# Memory Benchmark History
Purpose: track peak RSS profiling runs over time for regression checks. Canonical workflow lives in [`docs/features/memory-usage-profiling.md`](memory-usage-profiling.md).
## Regenerate
```sh
python3 scripts/profile_memory.py --repo . --all --iterations 1
```
Artifacts written by default:
```text
target/profiling/memory/profile-results.json
target/profiling/memory/profile-summary.md
target/profiling/memory/<scenario>.log
```
Default run is offline and credential-free: temp `MC_HOME`, synthetic fixtures, no `auth.json`, and credential-looking env stripped from child processes.
## Run sources
| Local baseline | unknown | unknown | `target/profiling/memory/profile-results.json` | Add first measured local run here; do not infer missing fields. |
## Scenario history
Primary memory metric is peak resident set size. Compare `max RSS MB` from same machine/profile only.
| startup_discovery | Local baseline | unknown | unknown | unknown | unknown | unknown |
| provider_sse_parser | Local baseline | unknown | unknown | unknown | unknown | unknown |
| rendering_heavy_transcript | Local baseline | unknown | unknown | unknown | unknown | unknown |
| tui_streaming_simulation | Local baseline | unknown | unknown | unknown | unknown | unknown |
| tool_timeout_cleanup | Local baseline | unknown | unknown | unknown | unknown | unknown |
## Delta rules
Use `max RSS MB` as main comparison value. For comparable runs:
```text
delta = (current max RSS MB - previous max RSS MB) / previous max RSS MB
```
Treat >5% peak RSS increase versus previous comparable run as investigation trigger, not automatic failure. If previous value is `unknown`, skip delta and collect a fresh baseline.
## Update rules
1. Run command above on same machine/profile when possible.
2. Copy `generated_at`, commit, platform, Rust version, and per-scenario rows from `profile-results.json`.
3. Add rows; do not overwrite history.
4. Record missing fields as `unknown`, never inferred.
5. Keep raw profiling artifacts out of git; default path is ignored under `target/`.
6. Record platform caveats when OS, allocator, Rust version, or release/debug profile differs from prior run.