stdx.allocator.gc_allocator
-
Declaration
structGCAllocator;D's built-in garbage-collected allocator.
Examples
auto buffer = GCAllocator.instance.allocate(1024 * 1024 * 4); // deallocate upon scope's end (alternatively: leave it to collection) scope(exit) GCAllocator.instance.deallocate(buffer); //...
-
Declaration
enum uintalignment;The
alignmentis a static constant equal to , which ensures properalignmentfor any D data type. -
Declaration
shared pure nothrow @trusted void[]allocate(size_tbytes);
shared @system boolexpand(ref void[]b, size_tdelta);
shared pure nothrow @system boolreallocate(ref void[]b, size_tnewSize);
shared pure nothrow TernaryresolveInternalPointer(const void*p, ref void[]result);
shared pure nothrow @system booldeallocate(void[]b);
shared size_tgoodAllocSize(size_tn);Standard allocator methods per the semantics defined above. The and methods are because they may move memory around, leaving dangling pointers in user code.
-
Declaration
static shared GCAllocatorinstance;Returns the global
instanceof this allocator type. The garbage collected allocator is thread-safe, therefore all of its methods anditself are .instance