mi-malloc: Runtime Options

| mi-malloc 1.8/2.1 |

Loading...
Searching...
No Matches
Enumerations | Functions
Runtime Options

Set runtime parameters. More...

## Enumerations
enum | mi_option_t { mi_option_show_errors , mi_option_show_stats , mi_option_verbose , mi_option_max_errors , mi_option_max_warnings , mi_option_reserve_huge_os_pages , mi_option_reserve_huge_os_pages_at , mi_option_reserve_os_memory , mi_option_allow_large_os_pages , mi_option_purge_decommits , mi_option_arena_reserve , mi_option_os_tag , mi_option_retry_on_oom , mi_option_generic_collect , mi_option_allow_thp , mi_option_guarded_min , mi_option_guarded_max , mi_option_guarded_precise , mi_option_guarded_sample_rate , mi_option_guarded_sample_seed , mi_option_eager_commit , mi_option_eager_commit_delay , mi_option_arena_eager_commit , mi_option_abandoned_page_purge , mi_option_purge_delay , mi_option_use_numa_nodes , mi_option_disallow_os_alloc , mi_option_max_segment_reclaim , mi_option_destroy_on_exit , mi_option_arena_purge_mult , mi_option_abandoned_reclaim_on_free , mi_option_purge_extend_delay , mi_option_disallow_arena_alloc , mi_option_visit_abandoned , mi_option_target_segments_per_thread , mi_option_page_reclaim_on_free , mi_option_page_full_retain , mi_option_page_max_candidates , mi_option_max_vabits , mi_option_pagemap_commit , mi_option_page_commit_on_demand , mi_option_page_max_reclaim , mi_option_page_cross_thread_max_reclaim , mi_option_minimal_purge_size , mi_option_arena_max_object_size , _mi_option_last }
| Runtime options. More...

## Functions
void | mi_options_print (void)
| Print out all runtime parameters for mimalloc. Also printed with `MIMALLOC_VERBOSE=1` at startup.
void | mi_options_print_out (mi_output_fun *out, void *arg)
| Print out all process info.
bool | mi_option_is_enabled (mi_option_t option)
void | mi_option_enable (mi_option_t option)
void | mi_option_disable (mi_option_t option)
void | mi_option_set_enabled (mi_option_t option, bool enable)
void | mi_option_set_enabled_default (mi_option_t option, bool enable)
long | mi_option_get (mi_option_t option)
long | mi_option_get_clamp (mi_option_t option, long min, long max)
size_t | mi_option_get_size (mi_option_t option)
void | mi_option_set (mi_option_t option, long value)
void | mi_option_set_default (mi_option_t option, long value)

## Detailed Description

Set runtime parameters.

## Enumeration Type Documentation

## ◆ mi_option_t

enum mi_option_t

Runtime options.

Enumerator
mi_option_show_errors | Print error messages.
mi_option_show_stats | Print statistics on termination.
mi_option_verbose | Print verbose messages.
mi_option_max_errors | issue at most N error messages
mi_option_max_warnings | issue at most N warning messages
mi_option_reserve_huge_os_pages | reserve N huge OS pages (1GiB pages) at startup
mi_option_reserve_huge_os_pages_at | Reserve N huge OS pages at a specific NUMA node N.
mi_option_reserve_os_memory | reserve specified amount of OS memory in an arena at startup (internally, this value is in KiB; use mi_option_get_size())
mi_option_allow_large_os_pages | allow large (2 or 4 MiB) OS pages, implies eager commit.
mi_option_purge_decommits | should a memory purge decommit? (=1). Set to 0 to use memory reset on a purge (instead of decommit)
mi_option_arena_reserve | initial memory size for arena reservation (= 1 GiB on 64-bit) (internally, this value is in KiB; use mi_option_get_size())
mi_option_os_tag | tag used for OS logging (macOS only for now) (=100)
mi_option_retry_on_oom | retry on out-of-memory for N milli seconds (=400), set to 0 to disable retries. (only on windows)
mi_option_generic_collect | collect heaps every N (=10000) generic allocation calls
mi_option_allow_thp | allow transparent huge pages? (=1) (on Android =0 by default). Set to 0 to disable THP for the process.
mi_option_guarded_min | only used when building with MI_GUARDED: minimal rounded object size for guarded objects (=0)
mi_option_guarded_max | only used when building with MI_GUARDED: maximal rounded object size for guarded objects (=0)
mi_option_guarded_precise | disregard minimal alignment requirement to always place guarded blocks exactly in front of a guard page (=0)
mi_option_guarded_sample_rate | 1 out of N allocations in the min/max range will be guarded (=1000)
mi_option_guarded_sample_seed | can be set to allow for a (more) deterministic re-execution when a guard page is triggered (=0)
mi_option_eager_commit | v1,v2: eager commit segments? (after `eager_commit_delay` segments) (enabled by default).
mi_option_eager_commit_delay | v2: the first N segments per thread are not eagerly committed (but per page in the segment on demand)
mi_option_arena_eager_commit | eager commit arenas? Use 2 to enable just on overcommit systems (=2)
mi_option_abandoned_page_purge | v1,v2: immediately purge delayed purges on thread termination
mi_option_purge_delay | memory purging is delayed by N milli seconds; use 0 for immediate purging or -1 for no purging at all. (=10)
mi_option_use_numa_nodes | 0 = use all available numa nodes, otherwise use at most N nodes.
mi_option_disallow_os_alloc | 1 = do not use OS memory for allocation (but only programmatically reserved arenas)
mi_option_max_segment_reclaim | v2: max. percentage of the abandoned segments can be reclaimed per try (=10%)
mi_option_destroy_on_exit | if set, release all memory on exit; sometimes used for dynamic unloading but can be unsafe
mi_option_arena_purge_mult | multiplier for `purge_delay` for the purging delay for arenas (=10)
mi_option_abandoned_reclaim_on_free | v1,v2: allow to reclaim an abandoned segment on a free (=1)
mi_option_purge_extend_delay | v1,v2: extend purge delay on each subsequent delay (=1)
mi_option_disallow_arena_alloc | 1 = do not use arena's for allocation (except if using specific arena id's)
mi_option_visit_abandoned | allow visiting heap blocks from abandoned threads (=0)
mi_option_target_segments_per_thread | v1,v2: experimental (=0)
mi_option_page_reclaim_on_free | v3: reclaim abandoned pages on a free (=0). -1 disallowr always, 0 allows if the page originated from the current theap, 1 allow always
mi_option_page_full_retain | v3: retain N full (small) pages per size class (=2). Use -1 for infinite (as in v1,v2).
mi_option_page_max_candidates | v3: max candidate pages to consider for allocation (=4)
mi_option_max_vabits | v3: max user space virtual address bits to consider (=48)
mi_option_pagemap_commit | v3: commit the full pagemap (to always catch invalid pointer uses) (=0)
mi_option_page_commit_on_demand | v3: commit page memory on-demand (=0)
mi_option_page_max_reclaim | v3: don't reclaim pages of the same originating theap if we already own N pages (in that size class) (=-1 (unlimited))
mi_option_page_cross_thread_max_reclaim | v3: don't reclaim pages across threads if we already own N pages (in that size class) (=16)
mi_option_minimal_purge_size | v3: set minimal purge size (in KiB) (=0). By default set to either 64 or 2048 if THP is enabled. (internal value is in KiB so use mi_option_get_size())
mi_option_arena_max_object_size | v3: set maximal object size that can be allocated in an arena (in KiB) (=2GiB on 64-bit).
_mi_option_last |

## Function Documentation

## ◆ mi_option_disable()

void mi_option_disable | ( | mi_option_t | option | ) |

## ◆ mi_option_enable()

void mi_option_enable | ( | mi_option_t | option | ) |

## ◆ mi_option_get()

long mi_option_get | ( | mi_option_t | option | ) |

## ◆ mi_option_get_clamp()

long mi_option_get_clamp | ( | mi_option_t | option,
|  | long | min,
|  | long | max )

## ◆ mi_option_get_size()

size_t mi_option_get_size | ( | mi_option_t | option | ) |

## ◆ mi_option_is_enabled()

bool mi_option_is_enabled | ( | mi_option_t | option | ) |

## ◆ mi_option_set()

void mi_option_set | ( | mi_option_t | option,
|  | long | value )

## ◆ mi_option_set_default()

void mi_option_set_default | ( | mi_option_t | option,
|  | long | value )

## ◆ mi_option_set_enabled()

void mi_option_set_enabled | ( | mi_option_t | option,
|  | bool | enable )

## ◆ mi_option_set_enabled_default()

void mi_option_set_enabled_default | ( | mi_option_t | option,
|  | bool | enable )

## ◆ mi_options_print()

void mi_options_print | ( | void |  | ) |

Print out all runtime parameters for mimalloc. Also printed with `MIMALLOC_VERBOSE=1` at startup.

## ◆ mi_options_print_out()

void mi_options_print_out | ( | mi_output_fun * | out,
|  | void * | arg )

Print out all process info.

Parameters

  out | An output function or NULL for the default.
  arg | Optional argument passed to out (if not NULL) Also printed with `MIMALLOC_VERBOSE=1` at startup.

See also
  mi_options_print()