Commit 3170fe3
committed
perf(graph_builder): release dedup maps after Snapshot (Task A4)
GraphBuilder.Snapshot extracted deduped nodes/edges into sorted slices
but left builder.nodes and builder.edges maps holding references to
the same objects. With the slices and maps coexisting for the rest of
the enrich pipeline (~30 sec wall time on ~/projects/), ~280 MB of
duplicate references stayed live needlessly.
Clear the maps inside Snapshot before returning. Snapshot is now
single-shot — calling it twice on the same builder returns an empty
snapshot (acceptable; the only caller is analyzer.Enrich which calls
once).
Plan: docs/superpowers/plans/2026-05-13-enrich-oom-fix.md Task A4.
Verification:
- New TestSnapshotReleasesDedupMaps asserts both nodes + edges maps
are nilled after Snapshot returns.
- go test ./... -count=1: 876 pass (no regressions).1 parent e311d99 commit 3170fe3
2 files changed
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
| |||
109 | 117 | | |
110 | 118 | | |
111 | 119 | | |
112 | | - | |
| 120 | + | |
113 | 121 | | |
114 | 122 | | |
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
118 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
119 | 133 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
10 | 25 | | |
11 | 26 | | |
12 | 27 | | |
| |||
0 commit comments