std.experimental.allocator.mallocator

The C heap allocator.

Source: std/experimental/allocator/mallocator.d

Types 2

The C heap allocator.

Fields
uint alignmentThe alignment is a static constant equal to `platformAlignment`, which ensures proper alignment for any D data type.
Mallocator instanceReturns the global instance of this allocator type. The C heap allocator is thread-safe, therefore all of its methods and `it` itself are `shared`.
Methods
void[] allocate(size_t bytes) @trusted @nogc nothrow pure shared constStandard allocator methods per the semantics defined above. The `deallocate` and `reallocate` methods are `@system` because they may move memory around, leaving dangling pointers in user code. Some...
bool deallocate(void[] b) @system @nogc nothrow pure shared constDitto
bool reallocate(ref void[] b, size_t s) @system @nogc nothrow pure shared constDitto
void[] allocateZeroed()(size_t bytes) @trusted @nogc nothrow pure shared const

Aligned allocator using OS-specific primitives, under a uniform API.

Fields
uint alignmentThe default alignment is `platformAlignment`.
AlignedMallocator instanceReturns the global instance of this allocator type. The C heap allocator is thread-safe, therefore all of its methods and `instance` itself are `shared`.
Methods
void[] allocate(size_t bytes) @trusted @nogc nothrow pure sharedForwards to alignedAllocate(bytes).
bool reallocate(ref void[] b, size_t newSize) @system @nogc nothrow pure sharedForwards to alignedReallocate(b). Should be used with blocks obtained with `allocate` otherwise the custom alignment passed with `alignedAllocate` can be lost.