FYI - mo' work on std.allocator

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 28 09:03:39 PDT 2014


On 4/28/14, 6:34 AM, Steven Schveighoffer wrote:
> On Sun, 27 Apr 2014 01:43:08 -0400, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> Added SbrkRegion, SimpleBlocklist, and Blocklist.
>>
>> http://erdani.com/d/phobos-prerelease/std_allocator.html#.SbrkRegion
>> http://erdani.com/d/phobos-prerelease/std_allocator.html#.SimpleBlocklist
>> http://erdani.com/d/phobos-prerelease/std_allocator.html#.Blocklist
>>
>> https://github.com/andralex/phobos/blob/allocator/std/allocator.d
>>
>> Destruction is as always welcome. I plan to get into tracing tomorrow
>> morning.
>
> First time I've seen it, so I'm looking at everything.
>
> In the design docs:
>
> alignedAllocate(size_t s, uint a);, $(RES) is null ||
> $(RES).length == s) $(TD Similar to $(D allocate), with the additional
> guarantee
> that the memory returned is aligned to at least $(D a) bytes. $(D a)
> must be a
> power of 2 greater than $(D (void*).sizeof).))
>
> Why power of 2 greater than void*.sizeof? Seems like an extra check that
> isn't necessary.
>
> Consider that any block that is aligned to a power of 2 called N, it's
> also aligned by any power of 2 < N. I think specifying any power of 2 is
> fine (including 1!). If anything, a maximum power of 2 may be good,
> because that's not as easy to ensure.

Fair enough, I'll remove that part of the spec. Thanks! -- Andrei




More information about the Digitalmars-d mailing list