Skip to main content

Module memory

Module memory 

Source
Expand description

Memory tracking for the keyspace.

Provides byte-level accounting of memory used by entries. Updated on every mutation so the engine can enforce memory limits and report stats without scanning the entire keyspace.

§Platform notes

Overhead constants are empirical estimates for 64-bit platforms (x86-64, aarch64). On 32-bit systems these would be smaller; the effect is that we’d overestimate memory usage, which triggers eviction earlier than necessary but doesn’t cause correctness issues.

The constants assume Rust’s standard library allocator. Custom allocators (jemalloc, mimalloc) may have different per-allocation overhead.

Structs§

MemoryTracker
Tracks memory usage for a single keyspace.

Functions§

entry_size
Estimates the total memory footprint of a single entry.
value_size
Returns the byte size of a value’s payload.