mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-14 22:51:50 +03:00
--- Motivation: This new experimental memory-allocaction API returns a pointer to the allocation as well as the usable size of the allocated memory region. The `s` in `smallocx` stands for `sized`-`mallocx`, attempting to convey that this API returns the size of the allocated memory region. It should allow C++ P0901r0 [0] and Rust Alloc::alloc_excess to make use of it. The main purpose of these APIs is to improve telemetry. It is more accurate to register `smallocx(size, flags)` than `smallocx(nallocx(size), flags)`, for example. The latter will always line up perfectly with the existing size classes, causing a loss of telemetry information about the internal fragmentation induced by potentially poor size-classes choices. Instrumenting `nallocx` does not help much since user code can cache its result and use it repeatedly. --- Implementation: The implementation adds a new `usize` option to `static_opts_s` and an `usize` variable to `dynamic_opts_s`. These are then used to cache the result of `sz_index2size` and similar functions in the code paths in which they are unconditionally invoked. In the code-paths in which these functions are not unconditionally invoked, `smallocx` calls, as opposed to `mallocx`, these functions explicitly. --- [0]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0901r0.html |
||
|---|---|---|
| .. | ||
| arena.c | ||
| background_thread.c | ||
| base.c | ||
| bin.c | ||
| bitmap.c | ||
| ckh.c | ||
| ctl.c | ||
| div.c | ||
| extent.c | ||
| extent_dss.c | ||
| extent_mmap.c | ||
| hash.c | ||
| hook.c | ||
| jemalloc.c | ||
| jemalloc_cpp.cpp | ||
| large.c | ||
| log.c | ||
| malloc_io.c | ||
| mutex.c | ||
| mutex_pool.c | ||
| nstime.c | ||
| pages.c | ||
| prng.c | ||
| prof.c | ||
| rtree.c | ||
| sc.c | ||
| stats.c | ||
| sz.c | ||
| tcache.c | ||
| test_hooks.c | ||
| ticker.c | ||
| tsd.c | ||
| witness.c | ||
| zone.c | ||