std.allocator ready for some abuse

Tourist gravatar at gravatar.com
Sun Oct 27 03:53:11 PDT 2013


On Sunday, 27 October 2013 at 10:52:06 UTC, Tourist wrote:
> On Sunday, 27 October 2013 at 10:45:31 UTC, Andrei Alexandrescu 
> wrote:
>> On 10/26/13 8:00 AM, Andrei Alexandrescu wrote:
>>> 3. Mallocator could also implement these on Posix:
>>> http://man7.org/linux/man-pages/man3/posix_memalign.3.html. 
>>> However,
>>> Windows requires a specific call for deallocating aligned 
>>> memory. To
>>> accommodate both portably, we leave Mallocator as is and 
>>> create
>>> AlignedMallocator that uses the _aligned_* family on Windows 
>>> and the
>>> respective functions on Posix. On Windows, allocate() 
>>> requests would
>>> pass a default of platformSize (i.e. 16 I suspect) to 
>>> _aligned_malloc.
>>
>> Just implemented AlignedMallocator and pushed.
>>
>> http://erdani.com/d/phobos-prerelease/std_allocator.html#.AlignedMallocator
>>
>> Untested on Windows.
>>
>>
>> Andrei
>
> In the following line:
> ----------
> On Posix, forwards to realloc. On Windows, calls 
> _aligned_realloc(b.ptr, newSize, platformAlignment).
> ----------
>
> Link is incorrect (http//, colon is missing).

That's how Firefox interprets it.
In source code it's:
http://http//msdn.microsoft.com/en-US/library/y69db7sx(v=vs.80).aspx


More information about the Digitalmars-d mailing list