Skip to content

cache: t4 keeps a tombstone for every removed key #92

Open

Description

@zfarrell

Found by a memory-accounting audit of 8b3c813. The tests are on branch audit/memory-tests and fail on main today; check out that branch to run them. File and line links point at that commit.

What goes wrong. t4 0.1.9 keeps an in-memory tombstone for every key ever removed until the store is remounted. Its index therefore grows with the number of distinct keys ever spilled, not with live ones. The root cause is in t4, as with #63, but the cost lands here.

Evidence.

  • At a steady population of about 1,350 live entries, heap grew 80.5 bytes per key ever spilled (release build, or debug with the trace drained), with no plateau.
  • The t4 store alone, with no cache, grew 82.1 bytes per removed key.
  • Projection: about 0.8 GB per 10 million keys.

Tests.

Test File Command Flags
claim2_heap_per_key_ever_spilled src/core/tests/disk_tier_audit.rs:206 AUDIT_DRAIN=1 cargo +1.96.0 test -p liquid-cache --test disk_tier_audit claim2_heap_per_key_ever_spilled -- --nocapture --test-threads=1 200,000 keys, about 17 s debug; use the default N (below 200k, capacity doubling distorts the slope)
claim2_control_store_alone src/core/tests/disk_tier_audit.rs:302 cargo +1.96.0 test -p liquid-cache --test disk_tier_audit claim2_control_store_alone -- --nocapture --test-threads=1 t4 only

Flags: P probabilistic (a pass after a fix only means the race wasn't hit), F interleaving forced by a test hook, L Linux only, D needs Docker, M measurement only, C control (passes by design).

Activity

  1. added
    bugSomething isn't working
    memoryMemory accounting or memory usage
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmemoryMemory accounting or memory usage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions