BoehmAllocator

Allocator for BDWGC-managed memory, implementing IAllocator. Thread-safe and compatible with -betterC. Requires thread registration for multi-threaded use when GCThreads is enabled.

Alias This

allocate

Members

Functions

alignedAllocate
void[] alignedAllocate(size_t bytes, uint a)

Allocates aligned memory using GC_memalign, returns null if allocation fails

allocate
void[] allocate(size_t bytes)

Allocates memory of specified size, returns null if allocation fails

allocateZeroed
void[] allocateZeroed(size_t bytes)

Allocates zero-initialized memory

collect
void collect()

Triggers garbage collection

deallocate
bool deallocate(void[] b)

Deallocates memory, safe for null buffers

disable
void disable()

Disables garbage collection

enableIncremental
void enableIncremental()

Enables incremental garbage collection

goodAllocSize
size_t goodAllocSize(size_t n)

Suggests a good allocation size

isHeapPtr
bool isHeapPtr(void* ptr)

Checks if pointer is GC-managed

owns
bool owns(void[] b)

Checks if the allocator owns the memory block

reallocate
bool reallocate(void[] b, size_t newSize)

Reallocates memory to new size, handles zero-size deallocation

Static variables

instance
BoehmAllocator instance;

Global thread-safe instance

Variables

alignment
enum uint alignment;

Alignment ensures proper alignment for D data types

Meta