Expand description
Raw bindings to the in-tree mimalloc static amalgamation.
Structs§
- MiPurge
Holes Stats - Mirrors
mi_purge_holes_stats_t(issue #272, Bun parity P7b): what page hole purging actually reclaimed, process wide. Field order and types must matchmimalloc.hexactly. - MiRs
Layout Entry - One entry of the ABI layout table published by
mi_rs_layout_table. - mi_
dhat_ stats_ t - Mirrors
mi_dhat_stats_t(include/mimalloc/dhat.h) field-for-field. - mi_
memory_ callbacks_ t - Mirrors
mi_memory_callbacks_t(include/mimalloc/memory-events.h): one handler and one caller-ownedargpermi_memory_change_kind_t, indexed by the kind. - mi_
memory_ change_ t - Mirrors
mi_memory_change_t(include/mimalloc/memory-events.h) field-for-field. - mi_
memory_ snapshot_ t - Mirrors
mi_memory_snapshot_t(include/mimalloc/memory-events.h) field-for-field. - mi_
prof_ config_ t - Mirrors
mi_prof_config_t(include/mimalloc/profile.h) field-for-field. - mi_
prof_ module_ info_ t - Mirrors
mi_prof_module_info_t(include/mimalloc/profile.h) field-for-field. - mi_
prof_ sample_ info_ t - Mirrors
mi_prof_sample_info_t(include/mimalloc/profile.h) field-for-field. - mi_
prof_ stats_ t - Mirrors
mi_prof_stats_t(include/mimalloc/profile.h) field-for-field. - mi_
stat_ count_ t - Mirrors
mi_stat_count_t: a quantity tracked over time. - mi_
stat_ counter_ t - Mirrors
mi_stat_counter_t: a monotonically increasing counter. - mi_
stats_ t - Mirrors
mi_stats_t(include/mimalloc-stats.h) field-for-field, including the reserved-for-future-use arrays and the three size-segregated bin arrays. - mi_
subproc_ id_ t - Mirrors
mi_subproc_id_t(include/mimalloc.h): an abstract, pointer-sized handle.
Enums§
- mi_
heap_ t - Opaque handle for
mi_heap_t(issue #269, Bun parity P4): only ever seen behind a pointer here (mi_heap_get_seq), so this type is never constructed on the Rust side. - mi_
prof_ snapshot_ t - Opaque handle for
mi_prof_snapshot_t; the profiler never hands out a value, only a pointer, so this type is never constructed on the Rust side.
Constants§
- MI_
BIN_ HUGE - Mirrors
MI_BIN_HUGEininclude/mimalloc-stats.h; the bin arrays below holdMI_BIN_HUGE + 1entries. - MI_
CBIN_ COUNT - Mirrors
MI_CBIN_COUNT(mi_chunkbin_t) ininclude/mimalloc-stats.h. - MI_
DHAT_ STATS_ VERSION - Mirrors
MI_DHAT_STATS_VERSIONininclude/mimalloc/dhat.h. - MI_
MEMORY_ ALLOCATE - Mirrors
MI_MEMORY_ALLOCATE. - MI_
MEMORY_ CHANGE_ COUNT - Mirrors
MI_MEMORY_CHANGE_COUNT: the number of callback slots, not a kind. - MI_
MEMORY_ FREE - Mirrors
MI_MEMORY_FREE. - MI_
MEMORY_ RESIZE - Mirrors
MI_MEMORY_RESIZE. - MI_
MEMORY_ SNAPSHOT_ VERSION - Mirrors
MI_MEMORY_SNAPSHOT_VERSIONininclude/mimalloc/memory-events.h. - MI_
OPTIONS_ IN_ ORDER - Every enumerator of
mi_option_tup to and including_mi_option_last, in C declaration order, as(name, value)pairs. Used bytests/t19_layout.rsto check this mirror against the C enum, and byci/check_rust_surface.pyto check it againstinclude/mimalloc.h. - MI_
PROF_ CONFIG_ FALLBACK - Mirrors
mi_prof_config_mode_t’sMI_PROF_CONFIG_FALLBACK/MI_PROF_CONFIG_OVERRIDE(include/mimalloc/profile.h). - MI_
PROF_ CONFIG_ OVERRIDE - MI_
PROF_ CONFIG_ VERSION - Mirrors
MI_PROF_CONFIG_VERSIONininclude/mimalloc/profile.h. - MI_
PROF_ FORMAT_ PROTO - MI_
PROF_ FORMAT_ TEXT - Mirrors
MI_PROF_FORMAT_TEXT/MI_PROF_FORMAT_PROTO(include/mimalloc/profile.h). - MI_
PROF_ STAT_ VERSION - Mirrors
MI_PROF_STAT_VERSIONininclude/mimalloc/profile.h. - MI_
STAT_ VERSION - Mirrors
MI_STAT_VERSIONininclude/mimalloc-stats.h. - _mi_
option_ last - Sentinel: one past the last real option.
- mi_
option_ allow_ large_ os_ pages - Allow large (2 MiB) OS pages.
- mi_
option_ allow_ thp - Allow transparent huge pages.
- mi_
option_ arena_ eager_ commit - Eagerly commit arena memory.
- mi_
option_ arena_ is_ numa_ local - Treat arenas as NUMA local.
- mi_
option_ arena_ max_ object_ size - Largest object served from an arena.
- mi_
option_ arena_ purge_ mult - Multiplier on the arena purge delay.
- mi_
option_ arena_ reserve - Bytes to reserve per new arena.
- mi_
option_ deprecated_ abandoned_ page_ purge - Deprecated; kept for numbering.
- mi_
option_ deprecated_ eager_ commit - Deprecated; kept for numbering.
- mi_
option_ deprecated_ eager_ commit_ delay - Deprecated; kept for numbering.
- mi_
option_ deprecated_ max_ segment_ reclaim - Deprecated; kept for numbering.
- mi_
option_ deprecated_ page_ reset - Deprecated; kept for numbering.
- mi_
option_ deprecated_ purge_ extend_ delay - Deprecated; kept for numbering.
- mi_
option_ deprecated_ segment_ cache - Deprecated; kept for numbering.
- mi_
option_ deprecated_ segment_ reset - Deprecated; kept for numbering.
- mi_
option_ deprecated_ visit_ abandoned - Deprecated; kept for numbering.
- mi_
option_ destroy_ on_ exit - Release all memory on process exit.
- mi_
option_ disallow_ arena_ alloc - Refuse to allocate from arenas.
- mi_
option_ disallow_ os_ alloc - Refuse to allocate from the OS.
- mi_
option_ eager_ region_ commit - Deprecated upstream alias for
mi_option_arena_eager_commit. - mi_
option_ generic_ collect - Collect generically every N-th generic allocation.
- mi_
option_ guarded_ max - Maximum size for guard-page allocation.
- mi_
option_ guarded_ min - Minimum size for guard-page allocation.
- mi_
option_ guarded_ precise - Place guard pages precisely after the block.
- mi_
option_ guarded_ sample_ rate - Sample every N-th allocation for guard pages.
- mi_
option_ guarded_ sample_ seed - Seed for guard-page sampling.
- mi_
option_ large_ os_ pages - Deprecated upstream alias for
mi_option_allow_large_os_pages. - mi_
option_ limit_ os_ alloc - Deprecated upstream alias for
mi_option_disallow_os_alloc. - mi_
option_ max_ errors - Maximum error messages printed.
- mi_
option_ max_ vabits - Maximum virtual address bits to assume.
- mi_
option_ max_ warnings - Maximum warning messages printed.
- mi_
option_ memory_ events - Fork addition. Enable allocation-change accounting/callbacks
(
MIMALLOC_MEMORY_EVENTS). - mi_
option_ minimal_ purge_ size - Smallest range worth purging.
- mi_
option_ os_ tag - Tag passed to the OS allocator.
- mi_
option_ page_ commit_ on_ demand - Commit page memory on demand.
- mi_
option_ page_ cross_ thread_ max_ reclaim - Maximum cross-thread pages reclaimed at once.
- mi_
option_ page_ full_ retain - Number of full pages to retain per bin.
- mi_
option_ page_ max_ candidates - Candidate pages searched per allocation.
- mi_
option_ page_ max_ reclaim - Maximum pages reclaimed at once.
- mi_
option_ page_ reclaim_ on_ free - Reclaim abandoned pages on free.
- mi_
option_ pagemap_ commit - Commit the page map eagerly.
- mi_
option_ prof - Fork addition. Enable the allocation sampling profiler at process start
(
MIMALLOC_PROF). - mi_
option_ prof_ accum - Fork addition. Keep cumulative profiler counters until
mi_prof_reset. - mi_
option_ prof_ bt_ max - Fork addition. Maximum captured stack depth for the profiler.
- mi_
option_ prof_ max_ bytes - Fork addition. Budget in bytes for profiler-internal arena memory.
- mi_
option_ prof_ sample_ rate - Fork addition. Average byte interval between profiler samples.
- mi_
option_ prof_ seed - Fork addition. Profiler sampling PRNG seed; 0 = nondeterministic.
- mi_
option_ purge_ decommits - Purge decommits rather than resets.
- mi_
option_ purge_ delay - Milliseconds to delay purging.
- mi_
option_ purge_ holes - Fork addition (Bun). Discard the memory of free blocks inside still-used pages
on
mi_on_thread_idle. - mi_
option_ purge_ holes_ eager_ zero - Fork addition (Bun). Zero a range before discarding it, so a mis-scoped discard corrupts visibly.
- mi_
option_ purge_ holes_ full_ every - Fork addition (Bun). Every N-th sweep walks every page, ignoring the per-page skip check; 0 disables.
- mi_
option_ purge_ holes_ min_ interval - Fork addition (Bun). Minimum milliseconds between sweeps of one thread’s heaps.
- mi_
option_ purge_ zeroes - Fork addition, dead since #80. The slot is kept so nothing renumbers; setting
it parses but has no effect. Unrelated to
mi_option_purge_holes_eager_zero. - mi_
option_ reserve_ huge_ os_ pages - Reserve N huge OS pages at startup.
- mi_
option_ reserve_ huge_ os_ pages_ at - Reserve huge OS pages at a specific NUMA node.
- mi_
option_ reserve_ os_ memory - Reserve N KiB of OS memory at startup.
- mi_
option_ reset_ decommits - Deprecated upstream alias for
mi_option_purge_decommits. - mi_
option_ reset_ delay - Deprecated upstream alias for
mi_option_purge_delay. - mi_
option_ retry_ on_ oom - Retry count on OS out-of-memory.
- mi_
option_ scavenger - Fork addition (Bun). Run a background thread that purges scheduled arena memory.
- mi_
option_ show_ errors - Print error messages.
- mi_
option_ show_ stats - Print statistics on termination.
- mi_
option_ use_ numa_ nodes - Number of NUMA nodes to use.
- mi_
option_ verbose - Print verbose messages.
Functions§
- mi_
calloc ⚠ - mi_
dhat_ ⚠dump - mi_
dhat_ ⚠is_ enabled - mi_
dhat_ ⚠start - mi_
dhat_ ⚠stats_ get - mi_
dhat_ ⚠stop - mi_
expand ⚠ - Grow in place only; returns NULL if the block cannot be extended without moving.
- mi_free⚠
- mi_
heap_ ⚠dump_ json - Live per-heap -> per-page -> (optional) per-block JSON snapshot (issue #269, Bun
parity P4). Backs Bun’s shipped
bun:jscheapStats({dump:true|"blocks"}). Returns NULL on allocation failure; a non-NULL result ismi_malloc-family memory the caller must free withmi_free(seeprof::heap_dump_jsonfor the safe wrapper). - mi_
heap_ ⚠get_ seq - Mirrors
mi_heap_get_seq(include/mimalloc-stats.h): the monotonic sequence number assigned toheapat creation, or 0 for a NULL heap. - mi_
heap_ ⚠stats_ get - Mirrors
mi_heap_stats_get. - mi_
heap_ ⚠stats_ get_ json - Mirrors
mi_heap_stats_get_json. - mi_
heap_ ⚠stats_ merge_ to_ subproc - Mirrors
mi_heap_stats_merge_to_subproc: fold a heap’s stats into its subprocess and clear the heap’s own. - mi_
heap_ ⚠stats_ print_ out - Mirrors
mi_heap_stats_print_out. - mi_
malloc ⚠ - mi_
malloc_ ⚠aligned - mi_
memory_ ⚠set_ callbacks - Mirrors
mi_memory_set_callbacks.callbacks == NULLclears the table. Theargpointers are caller-owned and must stay valid until replaced or cleared. - mi_
memory_ ⚠snapshot - Mirrors
mi_memory_snapshot; fillsize/versionin before calling. - mi_
memory_ ⚠tracking_ is_ enabled - Mirrors
mi_memory_tracking_is_enabled. - mi_
memory_ ⚠tracking_ set_ enabled - Mirrors
mi_memory_tracking_set_enabled; returns the previous state. An explicit call is always authoritative over theMIMALLOC_MEMORY_EVENTSenvironment read. - mi_
memory_ ⚠visit_ live_ allocations - Mirrors
mi_memory_visit_live_allocations. Best effort, not a consistent global snapshot; the visitor must not allocate, free, or reenter mimalloc. - mi_
on_ ⚠thread_ idle - Mirrors
mi_on_thread_idle(issue #272, Bun parity P7a). - mi_
on_ ⚠thread_ idle_ end - Mirrors
mi_on_thread_idle_end. - mi_
on_ ⚠thread_ idle_ start - Mirrors
mi_on_thread_idle_start;falsemeans nothing was handed off andmi_on_thread_idle_endmust NOT be called. - mi_
option_ ⚠disable - Mirrors
mi_option_disable. - mi_
option_ ⚠enable - Mirrors
mi_option_enable. - mi_
option_ ⚠get - Mirrors
mi_option_get. - mi_
option_ ⚠get_ clamp - Mirrors
mi_option_get_clamp. - mi_
option_ ⚠get_ size - Mirrors
mi_option_get_size. - mi_
option_ ⚠is_ enabled - Mirrors
mi_option_is_enabled. - mi_
option_ ⚠set - Mirrors
mi_option_set. - mi_
option_ ⚠set_ default - Mirrors
mi_option_set_default. - mi_
option_ ⚠set_ enabled - Mirrors
mi_option_set_enabled. - mi_
option_ ⚠set_ enabled_ default - Mirrors
mi_option_set_enabled_default. - mi_
options_ ⚠print_ out - Mirrors
mi_options_print_out: prints every option’s current value. - mi_
prof_ ⚠debug_ stats - mi_
prof_ ⚠dump - mi_
prof_ ⚠dump_ proto - profile.proto (google/pprof) writer: same sample/period/mapping semantics as
mi_prof_dump/mi_prof_dump_writerbut encoded as an uncompressed, binary pprof Profile message instead of the legacy “heap profile:” text. - mi_
prof_ ⚠dump_ proto_ writer - mi_
prof_ ⚠dump_ writer - mi_
prof_ ⚠is_ enabled - mi_
prof_ ⚠modules_ visit - Structured module (mapping) enumeration, e.g. to build pprof Mapping entries
yourself. No profiler lock is taken: module lists are OS-owned, not part of
the sampled-allocation table.
info(andinfo->path) are valid only for the duration of the callback. - mi_
prof_ ⚠reset - mi_
prof_ ⚠snapshot_ free - mi_
prof_ ⚠snapshot_ new - mi_
prof_ ⚠snapshot_ visit - mi_
prof_ ⚠start - mi_
prof_ ⚠start_ ex - mi_
prof_ ⚠start_ seeded - mi_
prof_ ⚠stats_ get - mi_
prof_ ⚠stop - mi_
prof_ ⚠visit - mi_
purge_ ⚠holes_ report - Mirrors
mi_purge_holes_report(issue #272, Bun parity P7b): prints, per size class, the free bytes hole purging could NOT discard. Read-only; purges nothing. - mi_
purge_ ⚠holes_ stats_ get - Mirrors
mi_purge_holes_stats_get(issue #272, Bun parity P7b). - mi_
realloc ⚠ - mi_
realloc_ ⚠aligned - mi_
recalloc ⚠ - mi_
recalloc_ ⚠aligned - mi_
rezalloc ⚠ - mi_
rezalloc_ ⚠aligned - mi_
rs_ ⚠layout_ table - Publishes what the C compiler laid out for every mirrored type, constant and
option in this module. Defined by
layout_probe.c(a rust/-side verification artifact, not part of the C library) and consumed bytests/t19_layout.rs. - mi_
scavenger_ ⚠stop - Mirrors
mi_scavenger_stop(issue #272). - mi_
stats_ ⚠as_ json - Mirrors
mi_stats_as_json: render an already-capturedmi_stats_t. - mi_
stats_ ⚠get - Mirrors
mi_stats_get: aggregated stats for the current subprocess and its heaps. - mi_
stats_ ⚠get_ bin_ size - Mirrors
mi_stats_get_bin_size: the block size served by size binbin. - mi_
stats_ ⚠get_ json - Mirrors
mi_stats_get_json. Withbuf == NULLthe result ismi_malloc-family memory the caller must release withmi_free. - mi_
stats_ ⚠print_ out - Mirrors
mi_stats_print_out. - mi_
subproc_ ⚠current - Mirrors
mi_subproc_current: the subprocess this thread belongs to. - mi_
subproc_ ⚠heap_ stats_ print_ out - Mirrors
mi_subproc_heap_stats_print_out: the subprocess and each of its heaps, printed separately. - mi_
subproc_ ⚠main - Mirrors
mi_subproc_main: the process-wide default subprocess. - mi_
subproc_ ⚠stats_ get - Mirrors
mi_subproc_stats_get. - mi_
subproc_ ⚠stats_ get_ exclusive - Mirrors
mi_subproc_stats_get_exclusive: the subprocess’s own stats, without aggregating its heaps. - mi_
subproc_ ⚠stats_ get_ json - Mirrors
mi_subproc_stats_get_json. - mi_
subproc_ ⚠stats_ print_ out - Mirrors
mi_subproc_stats_print_out. - mi_
unwrapped_ ⚠free - Mirrors
mi_unwrapped_free(include/mimalloc/memory-events.h). - mi_
unwrapped_ ⚠malloc - Mirrors
mi_unwrapped_malloc(include/mimalloc/memory-events.h): backed directly by the raw OS layer, never by the hookedmi_mallocfamily. See that header’s “Stable public unwrapped instrumentation allocation path” comment for the full contract. - mi_
unwrapped_ ⚠realloc - Mirrors
mi_unwrapped_realloc(include/mimalloc/memory-events.h). - mi_
usable_ ⚠size - mi_
zalloc ⚠ - mi_
zalloc_ ⚠aligned
Type Aliases§
- MiProf
Write Fun - mi_
memory_ allocation_ visit_ fun - Mirrors
mi_memory_allocation_visit_fun(include/mimalloc/memory-events.h). - mi_
memory_ change_ fun - Mirrors
mi_memory_change_fun(include/mimalloc/memory-events.h). - mi_
memory_ change_ kind_ t - Mirrors
mi_memory_change_kind_t. Declared as a plainc_intrather than a Rustenumon purpose: the value is produced by C, and materialising an out-of-range discriminant into a#[repr(i32)]enum would be undefined behaviour. - mi_
option_ t - Mirrors
mi_option_t(include/mimalloc.h). - mi_
output_ fun - Mirrors
mi_output_fun(include/mimalloc.h): mimalloc’s text output sink. - mi_
prof_ module_ visit_ fun - mi_
prof_ visit_ fun