std.allocator ready for some abuse

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Nov 1 14:05:45 PDT 2013


On 11/1/13 1:36 PM, Martin Nowak wrote:
> I have another request despite putting this in it's own repo.

I assume s/despite/in addition to/ :o).

> Often one want an exponentially (power of 2) growing step size for
> Bucketizer. Currently only equally spaced buckets are possible which
> isn't very practical to scale from 16b to 2Mb.
> http://erdani.com/d/phobos-prerelease/std_allocator.html#.Bucketizer

I considered the growth strategy as a policy. My personal favorite is 
"choose an approximate exponential growth strategy that keeps maximum 
internal fragmentation less than x%." That's how jemalloc is dimensioned.

I decided to stick with linear at least for now, for a simple reason: 
it's easy enough to simply enumerate the strategy by hand by using 
Segregator. Exponentials quickly grow to span a bunch of memory, so 
there aren't a lot of terms involved. Nevertheless it would be a nice 
illustration of D's generative powers.


Andrei



More information about the Digitalmars-d mailing list