deallocate

Frees previously allocated memory block.

  1. void deallocate(T[] memory)
  2. void deallocate(T* memory)
    @nogc nothrow @system
    void
    deallocate
    (
    T
    )
    ()

Parameters

memory T*

Previously allocated memory block (or null, in which case nothing happens).

Examples

Consider using scope(exit) to ensure deallocation (but beware of double frees).

auto cacheLine = allocate!ubyte(64);
scope(exit) cacheLine.deallocate();
assert(cacheLine != null);