Crate libmimalloc_sys

Source

Structs§

mi_heap_area_t
An area of heap space contains blocks of a single size.

Enums§

mi_heap_t
First-class heaps that can be destroyed in one go.

Constants§

MI_SMALL_SIZE_MAX
The maximum number of bytes which may be used as an argument to a function in the _small family (mi_malloc_small, mi_zalloc_small, etc).
_mi_option_last
Last option.
mi_option_eager_commit_delay
Option (experimental) the first N segments per thread are not eagerly committed (=1).
mi_option_large_os_pages
The following options are experimental
mi_option_limit_os_alloc
Option (experimental) If set to 1, do not use OS memory for allocation (but only pre-reserved arenas)
mi_option_max_errors
Option (experimental)
mi_option_max_segment_reclaim
Option (experimental)
mi_option_max_warnings
Option (experimental)
mi_option_os_tag
Option (experimental) OS tag to assign to mimalloc’d memory
mi_option_reserve_huge_os_pages
Option (experimental) The number of huge OS pages (1GiB in size) to reserve at the start of the program.
mi_option_reserve_huge_os_pages_at
Option (experimental) Reserve huge OS pages at node N.
mi_option_reserve_os_memory
Option (experimental) Reserve specified amount of OS memory at startup, e.g. “1g” or “512m”.
mi_option_show_errors
Print error messages to stderr.
mi_option_show_stats
Print statistics to stderr when the program is done.
mi_option_use_numa_nodes
Option (experimental) Pretend there are at most N NUMA nodes; Use 0 to use the actual detected NUMA nodes at runtime.
mi_option_verbose
Print verbose messages to stderr.

Functions§

mi_aligned_alloc
Allocate size bytes aligned by alignment with alignment as the first parameter.
mi_calloc
Allocate count items of size length each.
mi_calloc_aligned
Allocate size * count bytes aligned by alignment.
mi_calloc_aligned_at
Allocate size * count bytes aligned by alignment at a specified offset, zero-initialized.
mi_cfree
Checked free: If p came from mimalloc’s heap (as decided by mi_is_in_heap_region), this is mi_free(p), but otherwise it is a no-op.
mi_check_owned
Check safely if any pointer is part of the default heap of this thread.
mi_collect
Eagerly free memory.
mi_expand
Try to re-allocate memory to newsize bytes in place.
mi_free
Free previously allocated memory.
mi_free_aligned
Alignment-aware deallocation: Like mi_free, but accepts the size and alignment as well.
mi_free_size
Size-aware deallocation: Like mi_free, but accepts the size and alignment as well.
mi_free_size_aligned
Layout-aware deallocation: Like mi_free, but accepts the size and alignment as well.
mi_good_size
Return the used allocation size.
mi_heap_calloc
Equivalent to mi_calloc, but allocates out of the specific heap instead of the default.
mi_heap_calloc_aligned
Equivalent to mi_calloc_aligned, but allocates out of the specific heap instead of the default.
mi_heap_calloc_aligned_at
Equivalent to mi_calloc_aligned_at, but allocates out of the specific heap instead of the default.
mi_heap_check_owned
Check safely if any pointer is part of a heap.
mi_heap_collect
Release outstanding resources in a specific heap.
mi_heap_contains_block
Does a heap contain a pointer to a previously allocated block?
mi_heap_delete
Delete a previously allocated heap.
mi_heap_destroy
Destroy a heap, freeing all its still allocated blocks.
mi_heap_get_backing
Get the backing heap.
mi_heap_get_default
Get the default heap that is used for mi_malloc et al.
mi_heap_malloc
Equivalent to mi_malloc, but allocates out of the specific heap instead of the default.
mi_heap_malloc_aligned
Equivalent to mi_malloc_aligned, but allocates out of the specific heap instead of the default.
mi_heap_malloc_aligned_at
Equivalent to mi_malloc_aligned_at, but allocates out of the specific heap instead of the default.
mi_heap_malloc_small
Equivalent to mi_malloc_small, but allocates out of the specific heap instead of the default.
mi_heap_mallocn
Equivalent to mi_mallocn, but allocates out of the specific heap instead of the default.
mi_heap_new
Create a new heap that can be used for allocation.
mi_heap_realloc
Equivalent to mi_realloc, but allocates out of the specific heap instead of the default.
mi_heap_realloc_aligned
Equivalent to mi_realloc_aligned, but allocates out of the specific heap instead of the default.
mi_heap_realloc_aligned_at
Equivalent to mi_realloc_aligned_at, but allocates out of the specific heap instead of the default.
mi_heap_reallocf
Equivalent to mi_reallocf, but allocates out of the specific heap instead of the default.
mi_heap_reallocn
Equivalent to mi_reallocn, but allocates out of the specific heap instead of the default.
mi_heap_realpath
Equivalent to mi_realpath, but allocates out of the specific heap instead of the default.
mi_heap_recalloc
Equivalent to mi_recalloc, but allocates out of the specific heap instead of the default.
mi_heap_recalloc_aligned
Equivalent to mi_recalloc_aligned, but allocates out of the specific heap instead of the default.
mi_heap_recalloc_aligned_at
Equivalent to mi_recalloc_aligned_at, but allocates out of the specific heap instead of the default.
mi_heap_rezalloc
Equivalent to mi_rezalloc, but allocates out of the specific heap instead of the default.
mi_heap_rezalloc_aligned
Equivalent to mi_rezalloc_aligned, but allocates out of the specific heap instead of the default.
mi_heap_rezalloc_aligned_at
Equivalent to mi_rezalloc_aligned_at, but allocates out of the specific heap instead of the default.
mi_heap_set_default
Set the default heap to use for mi_malloc et al.
mi_heap_strdup
Equivalent to mi_strdup, but allocates out of the specific heap instead of the default.
mi_heap_strndup
Equivalent to mi_strndup, but allocates out of the specific heap instead of the default.
mi_heap_visit_blocks
Visit all areas and blocks in heap.
mi_heap_zalloc
Equivalent to mi_zalloc, but allocates out of the specific heap instead of the default.
mi_heap_zalloc_aligned
Equivalent to mi_zalloc_aligned, but allocates out of the specific heap instead of the default.
mi_heap_zalloc_aligned_at
Equivalent to mi_zalloc_aligned_at, but allocates out of the specific heap instead of the default.
mi_is_in_heap_region
Returns true if this is a pointer into a memory region that has been reserved by the mimalloc heap.
mi_malloc
Allocate size bytes.
mi_malloc_aligned
Allocate size bytes aligned by alignment.
mi_malloc_aligned_at
Allocate size bytes aligned by alignment at a specified offset.
mi_malloc_small
Allocate an object of no more than MI_SMALL_SIZE_MAX bytes.
mi_mallocn
Allocate count items of size length each.
mi_option_get
Returns the value of the provided option.
mi_option_is_enabled
Returns true if the provided option is enabled.
mi_option_set
Set the option to the given value.
mi_option_set_default
If the given option has not yet been initialized with mi_option_set or mi_option_set_enabled, sets the option to the given value. If it has, this function does nothing.
mi_option_set_enabled
Enable or disable the given option.
mi_option_set_enabled_default
If the given option has not yet been initialized with mi_option_set or mi_option_set_enabled, enables or disables the option. If it has, this function does nothing.
mi_posix_memalign
Allocate size of bytes aligned by alignment and place the address of the allocated memory to ptr.
mi_process_info
Return process information (time and memory usage). All parameters are optional (nullable) out-params:
mi_process_init
Initialize the process.
mi_realloc
Re-allocate memory to newsize bytes.
mi_realloc_aligned
Re-allocate memory to newsize bytes, aligned by alignment.
mi_realloc_aligned_at
Re-allocate memory to newsize bytes aligned by alignment at a specified offset.
mi_reallocf
Re-allocate memory to newsize bytes.
mi_reallocn
Re-allocate memory to count elements of size bytes.
mi_realpath
Resolve a file path name, producing a C string which can be passed to mi_free.
mi_recalloc
Zero initialized re-allocation, following calloc paramater conventions.
mi_recalloc_aligned
Aligned version of mi_recalloc.
mi_recalloc_aligned_at
Offset-aligned version of mi_recalloc.
mi_register_deferred_free
Register a deferred free function.
mi_register_error
Register an error callback function.
mi_register_output
Register an output function.
mi_rezalloc
Zero initialized re-allocation.
mi_rezalloc_aligned
Aligned version of mi_rezalloc.
mi_rezalloc_aligned_at
Offset-aligned version of mi_rezalloc.
mi_stats_merge
Merge thread local statistics with the main statistics and reset.
mi_stats_print
Print the main statistics.
mi_stats_print_out
Print the main statistics.
mi_stats_reset
Reset statistics.
mi_strdup
Allocate and duplicate a nul-terminated C string.
mi_strndup
Allocate and duplicate a nul-terminated C string, up to n bytes.
mi_thread_done
Uninitialize mimalloc on a thread.
mi_thread_init
Initialize mimalloc on a thread.
mi_thread_stats_print_out
Print out heap statistics for this thread.
mi_usable_size
Return the available bytes in a memory block.
mi_version
Return the mimalloc version number.
mi_zalloc
Allocate zero-initialized size bytes.
mi_zalloc_aligned
Allocate size bytes aligned by alignment, initialized to zero.
mi_zalloc_aligned_at
Allocate size bytes aligned by alignment at a specified offset, zero-initialized.
mi_zalloc_small
Allocate an zero-initialized object of no more than MI_SMALL_SIZE_MAX bytes.

Type Aliases§

mi_block_visit_fun
Visitor function passed to mi_heap_visit_blocks
mi_deferred_free_fun
Type of deferred free functions. Must be thread-safe.
mi_error_fun
Type of error callback functions. Must be thread-safe.
mi_option_t
Runtime options. All options are false by default.
mi_output_fun
An output callback. Must be thread-safe.