std.allocator ready for some abuse

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Oct 28 08:16:39 PDT 2013


On 10/28/13 8:15 AM, Andrei Alexandrescu wrote:
> On 10/28/13 1:03 AM, Lars T. Kyllingstad wrote:
>> On Sunday, 27 October 2013 at 10:45:31 UTC, Andrei Alexandrescu wrote:
>>> Just implemented AlignedMallocator and pushed.
>>>
>>> http://erdani.com/d/phobos-prerelease/std_allocator.html#.AlignedMallocator
>>>
>>>
>>>
>>> Untested on Windows.
>>
>> It seems inconsistent that allocate() forwards to alignedAllocate(),
>> while reallocate() does not forward to alignedReallocate().  Why is this?
>>
>> Lars
>
> Two reasons: (1) Posix does not support aligned reallocation. That would
> make forwarding a pessimization on that OS; (2) On Windows, realloc()
> cannot be applied to memory gotten with _aligned_malloc and vice versa.
>
> Andrei

Oh, my mistake. On Windows reallocate() should forward to alignedReallocate.

Andrei


More information about the Digitalmars-d mailing list