Skip to main content

Module alloc

Module alloc 

Source
Expand description

How much the process has allocated and not freed.

The operating system reports what a process has committed, not how much of that is in use: a heap that grew for one large short-lived buffer can keep the memory after the buffer is freed. To tell the two apart srv counts its own allocations. CountingAlloc is the system allocator with three counters in front of it; srv’s main.rs installs it, and counts reads them. Committed memory far above the live bytes is memory the heap is keeping, not memory a structure holds.

It counts what goes through Rust’s allocator. A C library’s own malloc (SQLite’s page caches) is not in it.

Structs§

CountingAlloc
The system allocator, counted. It changes nothing about where memory comes from.
HeapCounts
What CountingAlloc has counted since the process started.

Constants§

LARGE_BYTES
An allocation of at least this many bytes is also counted as a large one: these are the buffers that push a heap up (a transcript read whole, a serialized reply).

Functions§

counts
The counts, or None in a process that does not allocate through CountingAlloc (a test binary, a helper program): there nothing was ever counted.