Crate tikv_jemalloc_sys
source ·Expand description
Rust bindings to the jemalloc C library.
jemalloc is a general purpose memory allocation, its documentation
can be found here:
- API documentation
- Wiki (design documents, presentations, profiling, debugging, tuning, …)
jemalloc exposes both a standard and a non-standard API.
Standard API
The standard API includes: the malloc, calloc, realloc, and
free, which conform to to ISO/IEC 9899:1990 (“ISO C90”),
posix_memalign which conforms to conforms to POSIX.1-2016, and
aligned_alloc.
Note that these standard leave some details as implementation defined.
This docs document this behavior for jemalloc, but keep in mind that other
standard-conforming implementations of these functions in other allocators
might behave slightly different.
Non-Standard API
The non-standard API includes: mallocx, rallocx, xallocx,
sallocx, dallocx, sdallocx, and nallocx. These functions all
have a flags argument that can be used to specify options. Use bitwise or
| to specify one or more of the following: MALLOCX_LG_ALIGN,
MALLOCX_ALIGN, MALLOCX_ZERO, MALLOCX_TCACHE,
MALLOCX_TCACHE_NONE, and MALLOCX_ARENA.
Environment variables
The MALLOC_CONF environment variable affects the execution of the allocation functions.
For the documentation of the MALLCTL namespace visit the jemalloc
documenation.
Constants
Statics
STDERR_FILENO file descriptor
is not suitable for this.Functions
align,
where a is a power of two.a.1 << la.tc.size bytes of memory at an address which is a multiple of
alignment.number objects, each
of whose size is size.ptr.ptr.mallctl but taking a mib as input instead of a name.mallctlbymib.size bytes of uninitialized memory.write_cb callback function pointer
and cbopaque data passed to write_cb, or malloc_message if write_cb
is null.ptr.size bytes of memory according to flags.mallocx function call with the same arguments.size bytes of memory at an address which is a multiple of
alignment and is placed in *ptr.ptr to be
at least size bytes.ptr to
size bytes.ptr.ptr with
size hint.ptr in
place to be at least size bytes, returning the real size of the
allocation.