test(probe): memory_retainer_profile — per-retainer RAM attribution + the permanent meter#206
Merged
Merged
Conversation
…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
There was a problem hiding this comment.
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.rsunder#[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. |
…loud skip accounting, unabbreviated names Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJsyQ1UgF8uJYR4HgpxEBB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-lspworkspace cache through the warm path, walks theIndexer, 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)
Urls + 242k FQN keys inqualified, per-symbolLocationURLs indefinitions— this re-ranked the fix plan (file-id interning is now the top structural prize).FileData.linesresident for every file: 48.5 MB.library_urisis 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