Slab Threshold and Key Reclamation Reference
TalonKV evicts expired TTL keys whenever resident memory reaches its default 88% RSS hard cap, falling back to a 16-key sampled LRU sweep (evict_batch_size=16) until usage falls to 84% RSS. Expired keys are always purged first before any live entry is dropped.
During normal traffic, a lightweight background loop checks 64 random entries every 250 ms so stale records do not pile up in slab pages. Under heavy write pressure, the synchronous memory gate runs inline on the write path, preventing kernel OOM kills while keeping read latency predictable.
Operators can override the slab eviction watermark or adjust the sample pool size in the engine config file. Pinned records flagged with NO_EVICT remain untouched by the LRU pass, and if a full 16-key sample contains only pinned entries, writes fail cleanly with ERR_MEM_CAP. Exported counters separate TTL expirations from capacity-driven LRU drops so teams can distinguish short cache lifetimes from undersized memory budgets in TalonKV deployments.