Function libmimalloc_sys::mi_manage_os_memory_ex

source ·
pub unsafe extern "C" fn mi_manage_os_memory_ex(
    start: *const c_void,
    size: usize,
    is_committed: bool,
    is_large: bool,
    is_zero: bool,
    numa_node: c_int,
    exclusive: bool,
    arena_id: *mut mi_arena_id_t
) -> bool
Expand description

Manage a particular memory area for use by mimalloc. This is just like mi_reserve_os_memory_ex except that the area should already be allocated in some manner and available for use my mimalloc.

§Safety

mimalloc will likely segfault when allocating from the arena if the arena start & size aren’t aligned with mimalloc’s MI_SEGMENT_ALIGN (e.g. 32MB on x86_64 machines).

  • start Start of the memory area
  • size The size of the memory area. Must be large than MI_ARENA_BLOCK_SIZE (e.g. 64MB on x86_64 machines).
  • commit Set true if the memory range is already commited.
  • is_large Set true if the memory range consists of large files, or if the memory should not be decommitted or protected (like rdma etc.).
  • is_zero Set true if the memory range consists only of zeros.
  • numa_node Possible associated numa node or -1.
  • exclusive Only allow allocations if specifically for this arena.
  • arena_id Pointer who’s value will be set to the new arena_id if successful.

Returns true if arena was successfully allocated