Allocation and freeing of small objects (of at most MI_SMALL_SIZE_MAX bytes). More...
Macros | |
| #define | MI_SMALL_WSIZE_MAX |
| Maximum number of machine words allowed for mi_wmalloc_small(). | |
| #define | MI_SMALL_SIZE_MAX |
| Maximum size in bytes allowed for small allocations in mi_malloc_small, mi_zalloc_small, mi_heap_malloc_small, mi_heap_zalloc_small, mi_theap_malloc_small, and mi_theap_zalloc_small (128*sizeof(size_t), or 1 KiB on 64-bit systems). | |
Functions | |
| void * | mi_malloc_small (size_t size) |
| Allocate a small object. | |
| void * | mi_wmalloc_small (size_t wsize) |
| v3: Allocate a small object with its size expressed in machine words. | |
| void * | mi_wzalloc_small (size_t wsize) |
| v3: As mi_wmalloc_small(), but zero-initialize the allocation. | |
| size_t | mi_wsize_from_size (size_t size) |
| v3: Convert a byte size to a number of sizeof(size_t) words, rounding up. | |
| void * | mi_zalloc_small (size_t size) |
| Allocate a zero initialized small object. | |
| void | mi_free_small (void *p) |
| v3: Can be used to free an object that was allocated with mi_malloc_small() or any allocation with a size < MI_SMALL_SIZE_MAX() | |
| void | mi_free_small_nonnull (void *p) |
| v3: Can be used to free an object that was allocated with mi_malloc_small() or any allocation with a size < MI_SMALL_SIZE_MAX() | |
| void | mi_free_small_local (void *p) |
| v3: As mi_free_small(), but the block's page must be owned by the calling thread. | |
| void | mi_free_small_local_nonnull (void *p) |
| As mi_free_small_local(), but p must not be NULL. | |
Allocation and freeing of small objects (of at most MI_SMALL_SIZE_MAX bytes).
These are meant for runtime systems that know the size is small, and do not check the size – use with care!
| #define MI_SMALL_SIZE_MAX |
Maximum size in bytes allowed for small allocations in mi_malloc_small, mi_zalloc_small, mi_heap_malloc_small, mi_heap_zalloc_small, mi_theap_malloc_small, and mi_theap_zalloc_small (128*sizeof(size_t), or 1 KiB on 64-bit systems).
| #define MI_SMALL_WSIZE_MAX |
Maximum number of machine words allowed for mi_wmalloc_small().
A machine word is sizeof(size_t) bytes.
| void mi_free_small | ( | void * | p | ) |
v3: Can be used to free an object that was allocated with mi_malloc_small() or any allocation with a size < MI_SMALL_SIZE_MAX()
| p | Pointer that was returned from mi_malloc_small et al. (or NULL ) |
This function is meant for use in run-time systems for best performance and does not check if the pointer was indeed allocated as a small object – use with care!
| void mi_free_small_local | ( | void * | p | ) |
v3: As mi_free_small(), but the block's page must be owned by the calling thread.
p may be NULL. The caller must guarantee both the small size and page ownership.
| void mi_free_small_local_nonnull | ( | void * | p | ) |
As mi_free_small_local(), but p must not be NULL.
| void mi_free_small_nonnull | ( | void * | p | ) |
v3: Can be used to free an object that was allocated with mi_malloc_small() or any allocation with a size < MI_SMALL_SIZE_MAX()
| p | Pointer that was returned from mi_malloc_small et al. Cannot be NULL ! |
This function is meant for use in run-time systems for best performance and does not check if the pointer was indeed allocated as a small object or not NULL – use with care!
| void * mi_malloc_small | ( | size_t | size | ) |
Allocate a small object.
| size | The size in bytes, can be at most MI_SMALL_SIZE_MAX. |
| void * mi_wmalloc_small | ( | size_t | wsize | ) |
v3: Allocate a small object with its size expressed in machine words.
| wsize | The number of words, at most MI_SMALL_WSIZE_MAX. Each word is sizeof(size_t) bytes, not necessarily the size of a pointer. |
| size_t mi_wsize_from_size | ( | size_t | size | ) |
v3: Convert a byte size to a number of sizeof(size_t) words, rounding up.
size must not exceed SIZE_MAX - (sizeof(size_t) - 1) to avoid overflow.
| void * mi_wzalloc_small | ( | size_t | wsize | ) |
v3: As mi_wmalloc_small(), but zero-initialize the allocation.
wsize must not exceed MI_SMALL_WSIZE_MAX.
| void * mi_zalloc_small | ( | size_t | size | ) |
Allocate a zero initialized small object.
| size | The size in bytes, can be at most MI_SMALL_SIZE_MAX. |