mi_ prefixed implementations of various C++ allocation functions. More...
Data Structures | |
| struct | mi_stl_allocator< T > |
| std::allocator implementation for mimalloc for use in STL containers. More... | |
Functions | |
| void * | mi_new (std::size_t n) noexcept(false) |
| like mi_malloc(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. | |
| void * | mi_new_n (size_t count, size_t size) noexcept(false) |
| like mi_mallocn(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. | |
| void * | mi_new_aligned (std::size_t n, std::align_val_t alignment) noexcept(false) |
| like mi_malloc_aligned(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. | |
| void * | mi_new_nothrow (size_t n) |
| like mi_malloc, but when out of memory, use std::get_new_handler but return NULL on failure. | |
| void * | mi_new_aligned_nothrow (size_t n, size_t alignment) |
| like mi_malloc_aligned, but when out of memory, use std::get_new_handler but return NULL on failure. | |
| void * | mi_new_realloc (void *p, size_t newsize) |
| like mi_realloc(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. | |
| void * | mi_new_reallocn (void *p, size_t newcount, size_t size) |
| like mi_reallocn(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. | |
| void * | mi_heap_alloc_new (mi_heap_t *heap, size_t size) |
| As mi_new(), allocating from the specified heap. | |
| void * | mi_heap_alloc_new_n (mi_heap_t *heap, size_t count, size_t size) |
| As mi_new_n(), allocating count elements of size bytes from the specified heap. | |
| void * | mi_theap_alloc_new (mi_theap_t *theap, size_t size) |
| As mi_new(), using a theap belonging to the calling thread. | |
| void * | mi_theap_alloc_new_n (mi_theap_t *theap, size_t count, size_t size) |
| As mi_new_n(), using a theap belonging to the calling thread. | |
| void * | mi_theap_alloc_new_nothrow (mi_theap_t *theap, size_t size) |
| As mi_new_nothrow(), using a theap belonging to the calling thread. | |
mi_ prefixed implementations of various C++ allocation functions.
These use C++ semantics on out-of-memory, generally calling std::get_new_handler and raising a std::bad_alloc exception on failure.
Note: use the mimalloc-new-delete.h header to override the new and delete operators globally. The wrappers here are mostly for convenience for library writers that need to interface with mimalloc from C++.
| struct mi_stl_allocator |
std::allocator implementation for mimalloc for use in STL containers.
For example:
| void * mi_heap_alloc_new | ( | mi_heap_t * | heap, |
| size_t | size ) |
As mi_new(), allocating from the specified heap.
| void * mi_heap_alloc_new_n | ( | mi_heap_t * | heap, |
| size_t | count, | ||
| size_t | size ) |
As mi_new_n(), allocating count elements of size bytes from the specified heap.
| void * mi_new | ( | std::size_t | n | ) |
like mi_malloc(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure.
| void * mi_new_aligned | ( | std::size_t | n, |
| std::align_val_t | alignment ) |
like mi_malloc_aligned(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure.
| void * mi_new_aligned_nothrow | ( | size_t | n, |
| size_t | alignment ) |
like mi_malloc_aligned, but when out of memory, use std::get_new_handler but return NULL on failure.
| void * mi_new_n | ( | size_t | count, |
| size_t | size ) |
like mi_mallocn(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure.
| void * mi_new_nothrow | ( | size_t | n | ) |
like mi_malloc, but when out of memory, use std::get_new_handler but return NULL on failure.
| void * mi_new_realloc | ( | void * | p, |
| size_t | newsize ) |
like mi_realloc(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure.
| void * mi_new_reallocn | ( | void * | p, |
| size_t | newcount, | ||
| size_t | size ) |
like mi_reallocn(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure.
| void * mi_theap_alloc_new | ( | mi_theap_t * | theap, |
| size_t | size ) |
As mi_new(), using a theap belonging to the calling thread.
| void * mi_theap_alloc_new_n | ( | mi_theap_t * | theap, |
| size_t | count, | ||
| size_t | size ) |
As mi_new_n(), using a theap belonging to the calling thread.
| void * mi_theap_alloc_new_nothrow | ( | mi_theap_t * | theap, |
| size_t | size ) |
As mi_new_nothrow(), using a theap belonging to the calling thread.