std.allocator ready for some abuse
safety0ff
safety0ff.dev at gmail.com
Sun Oct 27 11:26:09 PDT 2013
On Sunday, 27 October 2013 at 10:45:31 UTC, Andrei Alexandrescu
wrote:
> On 10/26/13 8:00 AM, Andrei Alexandrescu wrote:
>> 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
The constraints on the alignment parameter are neither documented
nor checked.
i.e. Alignment must be a power of two, and for posix_memalign it
must additionally be greater than sizeof(void*).
I can only think of one use case for needing runtime specified
alignment: allocating operating system page sized chunks.
Are there any other use cases?
More information about the Digitalmars-d
mailing list