Mimallocator

High-level interface for mimalloc.

Members

Functions

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

Allocates the size expressed in bytes aligned by alignment.

alignedReallocate
bool alignedReallocate(ref void[] b, size_t newSize, uint alignment)

Re-allocate memory to newsize bytes aligned by alignment.

allocate
void[] allocate(size_t bytes)

Allocates the size expressed in bytes.

deallocate
bool deallocate(void[] b)

Deallocate the specified memory block

expand
bool expand(ref void[] b, size_t delta)

Expands the array by increasing its length with the required delta.

goodAllocSize
size_t goodAllocSize(size_t size)

Return the memory size that will be allocated asking for the minimum required size.

owns
Ternary owns(const void[] b)

Checks if the memory has been allocated by this allocator.

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

Re-allocate memory to newsize bytes.

resolveInternalPointer
Ternary resolveInternalPointer(const void* p, ref void[] result)

Resolves a pointer to get the full memory block.

Static variables

instance
Mimallocator instance;

Returns the global instance of this allocator type. Mimallocator is thread-safe, all methods are shared.

Variables

alignment
enum uint alignment;

The alignment is a static constant equal to platformAlignment, which ensures proper alignment for any D data type.

Meta