mi-malloc  1.0
Aligned Allocation

Allocating aligned memory blocks. More...

Functions

void * mi_malloc_aligned (size_t size, size_t alignment)
 Allocate size bytes aligned by alignment. More...
 
void * mi_zalloc_aligned (size_t size, size_t alignment)
 
void * mi_calloc_aligned (size_t count, size_t size, size_t alignment)
 
void * mi_realloc_aligned (void *p, size_t newsize, size_t alignment)
 
void * mi_rezalloc_aligned (void *p, size_t newsize, size_t alignment)
 
void * mi_recalloc_aligned (void *p, size_t count, size_t size, size_t alignment)
 
void * mi_malloc_aligned_at (size_t size, size_t alignment, size_t offset)
 Allocate size bytes aligned by alignment at a specified offset. More...
 
void * mi_zalloc_aligned_at (size_t size, size_t alignment, size_t offset)
 
void * mi_calloc_aligned_at (size_t count, size_t size, size_t alignment, size_t offset)
 
void * mi_realloc_aligned_at (void *p, size_t newsize, size_t alignment, size_t offset)
 
void * mi_rezalloc_aligned_at (void *p, size_t newsize, size_t alignment, size_t offset)
 
void * mi_recalloc_aligned_at (void *p, size_t count, size_t size, size_t alignment, size_t offset)
 

Detailed Description

Allocating aligned memory blocks.

Function Documentation

◆ mi_calloc_aligned()

void* mi_calloc_aligned ( size_t  count,
size_t  size,
size_t  alignment 
)

◆ mi_calloc_aligned_at()

void* mi_calloc_aligned_at ( size_t  count,
size_t  size,
size_t  alignment,
size_t  offset 
)

◆ mi_malloc_aligned()

void* mi_malloc_aligned ( size_t  size,
size_t  alignment 
)

Allocate size bytes aligned by alignment.

Parameters
sizenumber of bytes to allocate.
alignmentthe minimal alignment of the allocated memory.
Returns
pointer to the allocated memory or NULL if out of memory. The returned pointer is aligned by alignment, i.e. (uintptr_t)p % alignment == 0.

Returns a unique pointer if called with size 0.

See also
_aligned_malloc (on Windows)
aligned_alloc (on BSD, with switched arguments!)
posix_memalign (on Posix, with switched arguments!)
memalign (on Linux, with switched arguments!)

◆ mi_malloc_aligned_at()

void* mi_malloc_aligned_at ( size_t  size,
size_t  alignment,
size_t  offset 
)

Allocate size bytes aligned by alignment at a specified offset.

Parameters
sizenumber of bytes to allocate.
alignmentthe minimal alignment of the allocated memory at offset.
offsetthe offset that should be aligned.
Returns
pointer to the allocated memory or NULL if out of memory. The returned pointer is aligned by alignment at offset, i.e. ((uintptr_t)p + offset) % alignment == 0.

Returns a unique pointer if called with size 0.

See also
_aligned_offset_malloc (on Windows)

◆ mi_realloc_aligned()

void* mi_realloc_aligned ( void *  p,
size_t  newsize,
size_t  alignment 
)

◆ mi_realloc_aligned_at()

void* mi_realloc_aligned_at ( void *  p,
size_t  newsize,
size_t  alignment,
size_t  offset 
)

◆ mi_recalloc_aligned()

void* mi_recalloc_aligned ( void *  p,
size_t  count,
size_t  size,
size_t  alignment 
)

◆ mi_recalloc_aligned_at()

void* mi_recalloc_aligned_at ( void *  p,
size_t  count,
size_t  size,
size_t  alignment,
size_t  offset 
)

◆ mi_rezalloc_aligned()

void* mi_rezalloc_aligned ( void *  p,
size_t  newsize,
size_t  alignment 
)

◆ mi_rezalloc_aligned_at()

void* mi_rezalloc_aligned_at ( void *  p,
size_t  newsize,
size_t  alignment,
size_t  offset 
)

◆ mi_zalloc_aligned()

void* mi_zalloc_aligned ( size_t  size,
size_t  alignment 
)

◆ mi_zalloc_aligned_at()

void* mi_zalloc_aligned_at ( size_t  size,
size_t  alignment,
size_t  offset 
)