Memory allocation in D

Robert Fraser fraserofthenight at gmail.com
Fri Nov 30 13:23:11 PST 2007


Sean Kelly wrote:
> For what it's worth, my concern with the current behavior is that its 
> worst-case scenario coincides with typical usage.  It is extremely 
> common for a programmer to use array sizes that are powers of two, and 
> this is the situation which results in the maximum unused space per 
> block (because the runtime adds 1 to the size of all array allocations 
> passed to the GC).  Totally stinks, and I'm running out of ideas.  I 
> don't suppose someone can offer a suggestion for how to address this, 
> other than "just always allocate exactly what they request and if they 
> get a page fault then too bad for them?"
> 
> 
> Sean

I'm sure you've probably read it, but I'll post it anyway:

http://www.cs.purdue.edu/homes/grr/ISMM98-grr-mps-cef.pdf

In particular:
"... [Objects] slightly larger than a page boundary lead to
significant internal fragmentation in the page-based large
object allocator as well. The high internal fragmentation
associated with both large small objects and small large
objects suggest that one should create an intermediate class
of medium objects."



More information about the Digitalmars-d mailing list