Skip to content

Fix Dashboard memory leaks on tab close (#835)#836

Merged
erikdarlingdata merged 1 commit intodevfrom
fix/835-dashboard-memory-leaks
Apr 14, 2026
Merged

Fix Dashboard memory leaks on tab close (#835)#836
erikdarlingdata merged 1 commit intodevfrom
fix/835-dashboard-memory-leaks

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

  • Ports the memory leak fixes from Lite (commit 2b61592) to the Dashboard
  • Adds Dispose() to Dashboard's ChartHoverHelper to unsubscribe mouse event handlers
  • Adds DisposeChartHelpers() to ServerTab, MemoryContent, ResourceMetricsContent, and QueryPerformanceContent — disposes all 53+ hover helpers when tabs close
  • Stores lambda event delegates as named fields in ServerTab so they can be unsubscribed in Unloaded
  • Stores and unsubscribes AlertAcknowledged handler in MainWindow.CloseTab_Click
  • Clears unfiltered data collections, filter/legend dictionaries, and baseline provider cache on tab close

Context

Issue #835 reports Dashboard memory growing to 4GB and never releasing. The prior memory fixes (#758, #762, #792) all targeted Lite's DuckDB layer. The Dashboard (WPF/SQL Server) had the same event handler and chart helper leak patterns but was never addressed.

Test plan

  • Open Dashboard, connect to a server, observe memory usage
  • Close the server tab, verify memory drops
  • Reopen the same server tab, verify no errors from double-unsubscribe
  • Verify chart hover tooltips still work after reopening
  • Verify alert acknowledgement still works
  • Open/close tabs repeatedly, confirm memory stays stable

🤖 Generated with Claude Code

… on tab close (#835)

Dashboard had the same memory leak patterns fixed in Lite (commit 2b61592)
but never received those fixes. When server tabs were closed, 53+ event
handlers and hover helpers remained subscribed, preventing GC from
collecting the tab and its child controls.

- Add Dispose() to Dashboard ChartHoverHelper (matches Lite)
- Add DisposeChartHelpers() to ServerTab, MemoryContent, ResourceMetricsContent,
  and QueryPerformanceContent
- Store lambda event delegates as named fields so they can be unsubscribed
- Unsubscribe all child control events in ServerTab_Unloaded (slicers,
  CriticalIssuesTab, MemoryTab, PerformanceTab, ResourceMetricsContent)
- Store and unsubscribe AlertAcknowledged handler in MainWindow.CloseTab_Click
- Clear unfiltered data collections, filter dictionaries, legend panels,
  and baseline provider cache on tab close

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 33ae14b into dev Apr 14, 2026
3 checks passed
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.

1 participant