英語版
このページの英語版を見る

std.experimental.allocator.gc_allocator

Dの組み込みガベージコレクション・アロケータ。
struct GCAllocator;
Dの組み込みガベージコレクション・アロケータ。
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);
//...
enum uint alignment;
アラインメントはplatformAlignment に等しい静的定数である。 に等しい静的定数であり、どのDデータ型に対しても適切なアライメントを保証する。
shared const pure nothrow @trusted void[] allocate(size_t bytes);

shared const pure nothrow @trusted bool expand(ref void[] b, size_t delta);

shared const pure nothrow @system bool reallocate(ref void[] b, size_t newSize);

shared const pure nothrow @nogc @trusted Ternary resolveInternalPointer(const void* p, ref void[] result);

shared const pure nothrow @nogc @system bool deallocate(void[] b);

shared const pure nothrow @nogc @safe size_t goodAllocSize(size_t n);
標準的なアロケータ・メソッドは、上で定義されたセマンティクスに従う。 deallocatereallocateメソッドは@system である。 メソッドは、ユーザー・コードにダングリング・ポインターを残してメモリを移動する可能性があるため、。
static shared const GCAllocator instance;
このアロケータ型のグローバル・インスタンスを返す。ガベージコレクションされた アロケータはスレッドセーフなので、すべてのメソッドと instanceそれ自身 はshared である。