docs/group__theap.html
Loading...
Searching...
No Matches
Thread-local heaps
v3 : Thread local heaps. More...
|
|
| typedef struct mi_theap_s | mi_theap_t |
| | Type of thread-local heaps.
|
| |
|
|
| mi_theap_t * | mi_heap_theap (mi_heap_t *heap) |
| | Return the thread-local theap for the given heap.
|
| |
| void | mi_theap_collect (mi_theap_t *theap, bool force) |
| | Release outstanding resources in a specific theap.
|
| |
| mi_theap_t * | mi_theap_set_default (mi_theap_t *theap) |
| | Set the default thread-local theap to use in the current thread for mi_malloc() et al.
|
| |
| mi_theap_t * | mi_theap_get_default () |
| | Get the default theap that is used for mi_malloc() et al. for the current thread.
|
| |
| void * | mi_theap_malloc (mi_theap_t *theap, size_t size) |
| | Allocate in a specific theap.
|
| |
| void * | mi_theap_malloc_small (mi_theap_t *theap, size_t size) |
| | Allocate a small object in a specific theap. size must be smaller or equal to MI_SMALL_SIZE_MAX().
|
| |
| void * | mi_theap_zalloc (mi_theap_t *theap, size_t size) |
| | Allocate zero-initialized in a specific heap.
|
| |
| void * | mi_theap_zalloc_small (mi_theap_t *theap, size_t size) |
| | Allocate a small object in a specific theap. size must be smaller or equal to MI_SMALL_SIZE_MAX().
|
| |
| void * | mi_theap_calloc (mi_theap_t *theap, size_t count, size_t size) |
| |
| void * | mi_theap_malloc_aligned (mi_theap_t *theap, size_t size, size_t alignment) |
| |
| void * | mi_theap_realloc (mi_theap_t *theap, void *p, size_t newsize) |
| |
v3 : Thread local heaps.
The use of thread-local heaps is discouraged and only recommended for special cases like runtime systems that keep their own thread-local state. The "theaps" are thread-local heaps that v3 uses internally to implement efficient first-class heaps.
v1 , v2 : the mi_heap_t heaps in v1/v2 are exactly these mi_theap_t theaps in v3.
| typedef struct mi_theap_s mi_theap_t |
Type of thread-local heaps.
| mi_theap_t * mi_heap_theap | ( | mi_heap_t * | heap | ) | |
Return the thread-local theap for the given heap.
Parameters
| heap | The owning heap. |
ReturnsThe theap that serves thread-local allocations for the given heap. This can be used by runtime systems to request the thread-local theap once and then use it in its allocation functions (like mi_theap_malloc() or mi_theap_malloc_small() ) to avoid re-looking up the theap at each allocation call.
| void * mi_theap_calloc | ( | mi_theap_t * | theap, | | | | size_t | count, | | | | size_t | size ) |
| void mi_theap_collect | ( | mi_theap_t * | theap, | | | | bool | force ) |
Release outstanding resources in a specific theap.
| mi_theap_t * mi_theap_get_default | ( | | ) | |
Get the default theap that is used for mi_malloc() et al. for the current thread.
ReturnsThe current default theap.
| void * mi_theap_malloc | ( | mi_theap_t * | theap, | | | | size_t | size ) |
Allocate in a specific theap.
See alsomi_malloc()
| void * mi_theap_malloc_aligned | ( | mi_theap_t * | theap, | | | | size_t | size, | | | | size_t | alignment ) |
| void * mi_theap_malloc_small | ( | mi_theap_t * | theap, | | | | size_t | size ) |
Allocate a small object in a specific theap. size must be smaller or equal to MI_SMALL_SIZE_MAX().
See alsomi_malloc_small()
| void * mi_theap_realloc | ( | mi_theap_t * | theap, | | | | void * | p, | | | | size_t | newsize ) |
| mi_theap_t * mi_theap_set_default | ( | mi_theap_t * | theap | ) | |
Set the default thread-local theap to use in the current thread for mi_malloc() et al.
Parameters
| theap | The new default theap. |
ReturnsThe previous default theap. By default it will point to the theap belonging to the main heap (mi_heap_main()).
| void * mi_theap_zalloc | ( | mi_theap_t * | theap, | | | | size_t | size ) |
Allocate zero-initialized in a specific heap.
See alsomi_zalloc()
| void * mi_theap_zalloc_small | ( | mi_theap_t * | theap, | | | | size_t | size ) |
Allocate a small object in a specific theap. size must be smaller or equal to MI_SMALL_SIZE_MAX().
See alsomi_zalloc_small()