numem.core.memory

Additional Memory Handling.

Functions that build on the numem hooks to implement higher level memory managment functionality.

Members

Functions

nu_aligned_alloc
void* nu_aligned_alloc(size_t size, size_t alignment)

Allocates memory with a given alignment.

nu_aligned_free
void nu_aligned_free(void* ptr, size_t alignment)

Frees aligned memory.

nu_aligned_realloc
void* nu_aligned_realloc(void* ptr, size_t size, size_t alignment)

Reallocates memory with a given alignment.

nu_aligned_realloc_destructive
void* nu_aligned_realloc_destructive(void* ptr, size_t size, size_t alignment)

Reallocates memory with a given alignment.

nu_aligned_size
size_t nu_aligned_size(size_t request, size_t alignment)

Gets the amount of bytes to allocate when requesting a specific amount of memory with a given alignment.

nu_dup
inout(T)[] nu_dup(inout(T)[] buffer)

Creates a shallow duplicate of the given buffer.

nu_freea
void nu_freea(T[] slice)

Frees a slice.

nu_idup
immutable(T)[] nu_idup(inout(T)[] buffer)

Creates a shallow immutable duplicate of the given buffer.

nu_is_overlapping
bool nu_is_overlapping(void* a, size_t aLength, void* b, size_t bLength)

Gets whether 2 memory ranges are overlapping.

nu_mallocT
void[AllocSize!T] nu_mallocT()

Allocates enough memory to contain Type T.

nu_malloca
T[] nu_malloca(size_t count)

Allocates and initializes a new slice.

nu_realign
void* nu_realign(void* ptr, size_t alignment)

Realigns ptr to the next increment of alignment

nu_release
T nu_release(T value)

Calls the release function of reference counted type T.

nu_resize
T[] nu_resize(T[] buffer, size_t length, int alignment)

Resizes a slice to be of the given size and alignment. If the slice is not yet allocated, it will be.

nu_retain
T nu_retain(T value)

Gets the retain function for type T and calls it.

nu_storageT
void[AllocSize!T] nu_storageT(T object)

Gets the storage space used by object.

nu_swap
void nu_swap(T a, T b)

Swaps around 2 values of the same type.

nu_terminate
inout(T)[] nu_terminate(inout(T)[] text)

Appends a null terminator at the end of the string, resizes the memory allocation if need be.

Variables

ALIGN_PTR_SIZE
enum size_t ALIGN_PTR_SIZE;

System pointer size.

Meta

Authors

Luna Nielsen, Guillaume Piolat