Back to Mimalloc

mi

docs/group__aligned.html

3.3.25.2 KB
Original Source

| | mi-malloc 1.8/2.1 | |

Loading...

Searching...

No Matches

Functions

Aligned Allocation

Allocating aligned memory blocks. More...

|

Functions

| | void * | mi_malloc_aligned (size_t size, size_t alignment) | | | Allocate size bytes aligned by alignment.
| | | | 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.
| | | | 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) | | |

Detailed Description

Allocating aligned memory blocks.

Note that alignment always follows size for consistency with the unaligned allocation API, but unfortunately this differs from posix_memalign and aligned_alloc in the C library.

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

| size | number of bytes to allocate. | | alignment | the minimal alignment of the allocated memory. |

Returnspointer to the allocated memory or NULL if out of memory, or if the alignment is not a power of 2 (including 0). The size is unrestricted (and does not have to be an integral multiple of the alignment). The returned pointer is aligned by alignment, i.e. (uintptr_t)p % alignment == 0. Returns a unique pointer if called with size 0.

Note that alignment always follows size for consistency with the unaligned allocation API, but unfortunately this differs from posix_memalign and aligned_alloc in the C library.

See alsoaligned_alloc (in the standard C11 library, with switched arguments!) _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. |

Returnspointer to the allocated memory or NULL if out of memory, or if the alignment is not a power of 2 (including 0). The size is unrestricted (and does not have to be an integral multiple of the alignment). 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_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 ) |

  • Generated by 1.11.0