Skip to content

feat(heap): net/gross/peak heap analysis across call tree and timeline - #868

Merged
lcottercertinia merged 3 commits into
certinia:mainfrom
lukecotter:feat-32-heap-peak
Jul 23, 2026
Merged

feat(heap): net/gross/peak heap analysis across call tree and timeline#868
lcottercertinia merged 3 commits into
certinia:mainfrom
lukecotter:feat-32-heap-peak

Conversation

@lukecotter

Copy link
Copy Markdown
Collaborator

📝 PR Overview

Heap was a single number that hid what actually happened, since Apex frees memory as well as allocating it. This splits heap into three metrics — net retained, gross allocated, and peak live — through the parser, call tree, tooltips and the timeline limits strip, so you can tell a real leak from harmless allocate-then-free churn and compare a path against the heap governor.

🛠️ Changes made

  • Parser: track a signed running live-heap to derive heapPeak (max-composed up the tree), keep heapAllocated as net (alloc − free), add heapGross for churn; governor heap = max(reported snapshot peak, computed peak).
  • Call tree / tabulator: replace the single Heap column with Net / Net-self / Peak / Alloc / Alloc-self byte columns with per-table footer calcs (peak max, net-total call-stack deduped); Memory view shows all three; Governor Avg/Peak use peak.
  • Timeline tooltip: show net heap retained (omitted when zero), thousand-separated.
  • Refactor: extract LogEvent.seedHeapLeaf and createSelfSumHeapFooters; delegate timeline formatNumber to the shared Util.formatInteger.
  • Docs: Heap analysis + Governor Limit Tracking sections in README/CHANGELOG/help site; note the limits strip builds usage per log event, not just at snapshots.

🧩 Type of change (check all applicable)

  • 🐛 Bug fix - something not working as expected
  • ✨ New feature – adds new functionality
  • ♻️ Refactor - internal changes with no user impact
  • ⚡ Performance Improvement
  • 📝 Documentation - README or documentation site changes
  • 🔧 Chore - dev tooling, CI, config
  • 💥 Breaking change

📷 Screenshots / gifs / video [optional]

Visible surfaces: the new Call Tree / Memory heap columns and the method tooltip heap row.

🔗 Related Issues

closes #32

✅ Tests added?

  • 👍 yes
  • 🙅 no, not needed
  • 🙋 no, I need help

📚 Docs updated?

  • 🔖 README.md
  • 🔖 CHANGELOG.md
  • 📖 help site
  • 🧪 Marked any pre-release-only features (README `🧪` badge — see RELEASING.md)
  • 🙅 not needed

Anything else we need to know? [optional]

Split heap into three distinct metrics through the parser, call-tree
aggregation, table columns and timeline tooltip.

- parser: track signed running live-heap to seed heapPeak (max-composed up the tree), keep heapAllocated as net (alloc − free), add heapGross for churn; governor heap = max(reported snapshot peak, computed heapPeak)
- aggregation: attribute self heap from direct leaf children only; roll peak up by max so root equals the transaction peak
- call-tree/tabulator: replace single Heap column with Net/Net-self/Peak/Alloc/Alloc-self byte columns and per-table footer calcs (peak always 'max', net-total call-stack deduped)
- format governor heap with formatInteger (thousand-separated) and show a net-heap tooltip row, omitted when net is 0
- extract LogEvent.seedHeapLeaf so HeapAllocateLine/BulkHeapAllocateLine share the net/gross/peak seeding
- add createSelfSumHeapFooters for the aggregated + time-order tables' identical heap footers
- delegate timeline formatNumber to the shared Util.formatInteger instead of a duplicate toLocaleString
- add Heap analysis changelog entry (certinia#32) and a Governor Limit Tracking README section
- describe net/gross/peak and the Memory view in the Call Tree docs
- note the governor strip builds usage per log event, not just at cumulative snapshots
@lcottercertinia
lcottercertinia merged commit 48bbb36 into certinia:main Jul 23, 2026
7 checks passed
@lukecotter
lukecotter deleted the feat-32-heap-peak branch July 23, 2026 15:59
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.

Add support for heap size

2 participants