Allocating aligned memory blocks.
More...
|
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_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) |
|
Allocating aligned memory blocks.
◆ MI_ALIGNMENT_MAX
The maximum supported alignment size (currently 1MiB).
◆ 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
-
size | number of bytes to allocate. |
alignment | the minimal alignment of the allocated memory. Must be less than MI_ALIGNMENT_MAX. |
- 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
-
size | number of bytes to allocate. |
alignment | the minimal alignment of the allocated memory at offset. |
offset | the 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_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 |
|
) |
| |