Expand description
Tracking global allocator + memory stats for the C ABI.
kglite-c installs a tracking allocator (wrapping the System
allocator) so a binding can observe the Rust-side heap via
kglite_memory_stats — current live bytes, peak since process
start, and total allocation count. Counters are process-wide.
Only allocations made through the Rust global allocator are counted;
the host runtime’s own heap (Go, the JVM, Node, …) is separate and
invisible here. The counters are maintained with Relaxed atomics —
cheap, and exact accounting across threads isn’t required for a
monitoring stat.
Structs§
- KgMem
Stats - Rust-heap statistics from kglite’s tracking allocator.
Functions§
- kglite_
memory_ stats - Return current Rust-heap statistics from kglite’s tracking allocator. Counts only allocations through the Rust global allocator — the host runtime’s own heap is separate. Useful for a binding to surface kglite’s memory footprint in its own metrics.