Unsubscribed Interval / Observable Memory Leak
What's Broken (Symptom)
Destroying `HeartbeatService` calls `ngOnDestroy()`, yet the `setInterval` subscription keeps firing `onTick` callbacks forever and leaks memory!
Expected Behavior
- Store the interval timer / subscription handle when `startPolling(onTick)` begins.
- `ngOnDestroy()` cleanly clears the active interval (`clearInterval` / unsubscribe).
- Zero further ticks execute after `ngOnDestroy()` is called, even across repeated start/destroy cycles.
Debugging Hints (0/2 used)
Try spotting the bug in the editor first. Need a nudge? Reveal Hint 1 anytime.
Root Cause Breakdown
Pass all 3 automated verification checks on the right to unlock the full Root Cause explanation.
Automated Bug Verification
3 Checks Ready- Fires interval ticks cleanly while activeTracker increments tick counter while mounted.
- Stops firing completely after ngOnDestroy()Zero orphan callbacks run after component/service destruction.
- Prevents duplicate parallel timers on repeated startPolling()Calling startPolling twice then ngOnDestroy cleans everything.
Live Sandboxed PreviewCtrl + Enter to verify
Console Output0 log(s)
No console output yet. Run Preview or Verify Bug Fix.