Expand description
A counting global allocator for memory measurements in tests and benchmarks.
ⓘ
#[global_allocator]
static A: simoom_sys::alloc::Counting = simoom_sys::alloc::Counting;It forwards to the system allocator and keeps the net number of live heap bytes, in total and per thread (bytes freed on another thread than the one that allocated them count against the freeing thread).
Structs§
- Counting
- The counting allocator. See the module docs.
Functions§
- allocation_
calls - Allocation calls so far (allocations, and reallocations that grow), process-wide.
- live_
allocations - Heap allocations of the whole process not freed yet (when
Countingis the global allocator). - release_
free_ memory - Asks the C allocator to give memory it holds free back to the operating system (glibc’s
malloc_trim; elsewhere nothing). The event loops call it once after a burst, when they have been idle for a while (K2): glibc keeps what a thread freed in that thread’s arena, so a burst of large responses otherwise left tens of MB resident. - reset_
thread_ peak - Starts a new peak for
thread_peak_bytesat the calling thread’s currentthread_bytes. - thread_
bytes - Net heap bytes allocated minus freed by the calling thread.
- thread_
peak_ bytes - The highest
thread_bytesof the calling thread since its lastreset_thread_peak(or since it started): what a piece of code needs at its peak, scratch included. - total_
bytes - Net live heap bytes of the whole process (when
Countingis the global allocator).