Skip to content

test(probe): memory_retainer_profile — per-retainer RAM attribution + the permanent meter#206

Merged
Hessesian merged 3 commits into
refactor/unified-resolutionfrom
perf/memory-probe
Jul 6, 2026
Merged

test(probe): memory_retainer_profile — per-retainer RAM attribution + the permanent meter#206
Hessesian merged 3 commits into
refactor/unified-resolutionfrom
perf/memory-probe

Conversation

@Hessesian

Copy link
Copy Markdown
Owner

Summary

First deliverable of the memory-reduction plan (docs/superpowers/plans/2026-07-04-memory-reduction.md): an #[ignore]d test that loads the largest real ~/.cache/kmp-lsp workspace cache through the warm path, walks the Indexer, and prints a per-retainer attribution table (entries / MB / % with a workspace-vs-library split) plus VmRSS phase checkpoints. Zero production changes (test-module wiring only).

Baseline it established (12,621 files, 117 MB index.bin, 156k symbols)

  • 269.6 MB accounted steady-state; 486.9 MB warm-load peak (apply held a full duplicate — fixed in the stacked PR).
  • Top cluster is URI/FQN string duplication ≈ 125 MB (46%): 242k parsed Urls + 242k FQN keys in qualified, per-symbol Location URLs in definitions — this re-ranked the fix plan (file-id interning is now the top structural prize).
  • FileData.lines resident for every file: 48.5 MB.
  • Found a bug: library_uris is empty after a warm cache load — library classification isn't restored, so every file counts as workspace.

Every memory PR from here pastes this probe's before/after table — no unmeasured claims.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EJsyQ1UgF8uJYR4HgpxEBB

…bute bytes per retainer

Ignored-by-default; runs against the largest ~/.cache/kmp-lsp workspace
cache (KMP_LSP_PROFILE_CACHE overrides). Prints entries/MB/% per retainer
with a workspace-vs-library split, plus VmRSS phase checkpoints. Baseline
(12,621 files, 117 MB index.bin): 269.6 MB accounted, 487 MB warm-load
peak (apply holds result vec + Indexer copy). Doubles as the before/after
meter for every memory-reduction PR.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EJsyQ1UgF8uJYR4HgpxEBB
… link on macOS/Windows

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EJsyQ1UgF8uJYR4HgpxEBB

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new ignored, test-only “memory attribution probe” that warm-loads a real on-disk cache, applies it via the same path as the server, then walks the reconstructed Indexer to print per-retainer RAM attribution and RSS phase checkpoints. This supports the broader memory-reduction plan by establishing a repeatable baseline and measurement harness without changing production behavior.

Changes:

  • Introduces memory_retainer_profile (#[ignore]) test that loads ~/.cache/kmp-lsp/**/index.bin, applies it, and prints an attribution table plus RSS checkpoints.
  • Adds internal sizing/accounting helpers to estimate per-structure retained bytes and split workspace vs library attribution.
  • Wires the new test module into src/indexer.rs under #[cfg(test)].

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/indexer/memory_probe_tests.rs New ignored test to warm-load a real cache and print per-retainer memory attribution + RSS checkpoints.
src/indexer.rs Adds #[cfg(test)] module inclusion for the new probe test.

Comment thread src/indexer/memory_probe_tests.rs
Comment thread src/indexer/memory_probe_tests.rs Outdated
Comment thread src/indexer/memory_probe_tests.rs
Comment thread src/indexer/memory_probe_tests.rs
Comment thread src/indexer/memory_probe_tests.rs Outdated
…loud skip accounting, unabbreviated names

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EJsyQ1UgF8uJYR4HgpxEBB
@Hessesian Hessesian merged commit f6b7110 into refactor/unified-resolution Jul 6, 2026
4 checks passed
@Hessesian Hessesian deleted the perf/memory-probe branch July 6, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants