SmallVector and SmallPtrSet allocations not power-of-two aligned

Jean-Luc Duprat jduprat at apple.com
Wed Mar 27 16:00:20 PDT 2013


Now with unit tests…

JL



On Mar 27, 2013, at 15:16 , Nadav Rotem <nrotem at apple.com> wrote:

> LGTM. 
> 
> 
> On 03/27/13, Jean-Luc Duprat <jduprat at apple.com> wrote:
>> 
>> While running dtrace on a large compile, focusing on memory usage, I found several strange allocations on x64.
>> Here is the trimmed output of my dtrace run---these read: allocation size\t number of such allocations
>> 
>> [snip: trimmed, leaving only allocation that seemed odd]
>>             32776              156
>>             16392              446
>>              8200              604
>>              4104              605
>>              2056              614
>>              1032             1212
>> 
>> Note that these allocations are 1032 bytes (1024+8), 2056 bytes (2048+8), 4104 bytes (4096+8), etc.
>> 
>> These were tracked down to SmallVector and SmallPtrSet, and the way they grow when no longer "small".
>> For SmallVector the fix is pretty minimal, just using better logic to compute the size of the next  allocation.  For SmallPtrSet the fix involved getting the allocator to track the end of the set, growing the size of the allocator itself rather than growing the set.
>> 
>> These changes moved all the allocations identified above to proper power-of-two allocations.  These changes have no impact on performance, but will help pool memory allocations together if needed.
>> 
>> Please provide feedback on the attached change.
>> Thank you,
>> 
>> JL
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130327/10d4e70d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_allocs.patch
Type: application/octet-stream
Size: 10456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130327/10d4e70d/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130327/10d4e70d/attachment-0001.html>


More information about the llvm-commits mailing list