gfm

This module provide support for aligned  memory.


pure nothrow @nogc void*  nextAlignedPointer(void* start, size_t alignment);

Returns
next pointer aligned with alignment bytes.

nothrow @nogc void*  alignedMalloc(size_t size, size_t alignment);

Allocates an aligned memory chunk.

Functionally equivalent to Visual C++ aligned_malloc.


nothrow @nogc void  alignedFree(void* aligned);

Frees aligned memory allocated by alignedMalloc or alignedRealloc.

Functionally equivalent to Visual C++ aligned_free.


nothrow @nogc void*  alignedRealloc(void* aligned, size_t size, size_t alignment);

Reallocates an aligned memory chunk allocated by alignedMalloc or  alignedRealloc.

Functionally equivalent to Visual C++ aligned_realloc.


nothrow bool  isCalledByGC();

Destructors called by the GC enjoy a variety of limitations and

relying on them is dangerous.

See Also
p0nce.github.io/d-idioms/#The-trouble-with-class-destructors
Example:
class Resource

{

~this()

{

if (!alreadyClosed)

{

if (isCalledByGC())

assert(false, "Resource release relies on Garbage Collection");

alreadyClosed = true;

releaseResource();

}

}

}


nothrow void  ensureNotInGC(string resourceName = null);

Crash if the GC is running.

Useful in destructors to avoid reliance GC resource release.

See Also
p0nce.github.io/d-idioms/#GC-proof-resource-class

auto  mallocEmplace(T, Args...)(Args args);

Allocates and construct a struct or class object.

Returns
Newly allocated object.

void  destroyFree(T)(T p) if (is(T == class));

Destroys and frees a class object created with mallocEmplace.


void  destroyFree(T)(T* p) if (!is(T == class));

Destroys and frees a non-class object created with mallocEmplace.


nothrow @nogc void  debugBreak();

Inserts a breakpoint instruction. useful to trigger the debugger.


Must return -1 if a < b

0 if a == b

1 if a > b


nothrow @nogc void  nogc_qsort(T)(T[] array, nogcComparisonFunction!T comparison);

@nogc quicksort

From the excellent: http://codereview.stackexchange.com/a/77788