Function jemalloc_sys::mallctl

source ·
pub unsafe extern "C" fn mallctl(
    name: *const c_char,
    oldp: *mut c_void,
    oldlenp: *mut size_t,
    newp: *mut c_void,
    newlen: size_t
) -> c_int
Expand description

General interface for introspecting the memory allocator, as well as setting modifiable parameters and triggering actions.

The period-separated name argument specifies a location in a tree-structured namespace (see jemalloc’s MALLCTL documentation).

To read a value, pass a pointer via oldp to adequate space to contain the value, and a pointer to its length via oldlenp``; otherwise pass null and null. Similarly, to write a value, pass a pointer to the value via newp, and its length via newlen`; otherwise pass null and 0.

Errors

Returns 0 on success, otherwise returns:

  • EINVAL: if newp is not null, and newlen is too large or too small. Alternatively, *oldlenp is too large or too small; in this case as much data as possible are read despite the error.

  • ENOENT: name or mib specifies an unknown/invalid value.

  • EPERM: Attempt to read or write void value, or attempt to write read-only value.

  • EAGAIN: A memory allocation failure occurred.

  • EFAULT: An interface with side effects failed in some way not directly related to mallctl read/write processing.