rxjs-leak-finder vs SubSink

SubSink is a tiny class that collects subscriptions so you can unsubscribe them all in ngOnDestroy. It's a clean way to manage teardown — but only for the subscriptions you remember to add to the sink. rxjs-leak-finder finds the rest.

The short version

SubSink gives you a sink you assign subscriptions to (this.subs.sink = obs$.subscribe(...)), then call this.subs.unsubscribe() in ngOnDestroy. It's an organizational pattern for manual teardown — less error-prone than juggling individual Subscription fields, but still opt-in per subscription.

rxjs-leak-finder doesn't manage subscriptions — it detects the ones that outlived their owner. The subscription you forgot to assign to the sink, the one added after a refactor, the one in a service with no ngOnDestroy: SubSink can't catch those because it never saw them. rxjs-leak-finder sees every subscribe() in the app.

Feature comparison

Capabilityrxjs-leak-finderSubSink
Primary jobDetect leaked subscriptionsOrganize manual teardown
Catches subscriptions you didn't track✅ Yes❌ No — only what you sink
BoilerplateOne line in main.tsthis.subs.sink = … per stream + unsubscribe() in ngOnDestroy
Tells you a leak exists✅ Dashboard + stack trace❌ No detection — assumes you wired it
Production footprintNone (dev-only)Tiny class ships in bundle
Maintenance statusActive (2026)Mature / low activity

They're not rivals

SubSink answers "how do I tear these down cleanly?" rxjs-leak-finder answers "did I miss any?" Keep SubSink (or takeUntilDestroyed) as your teardown mechanism, and run rxjs-leak-finder in dev to prove there are no gaps.

// main.ts (dev only)
import { isDevMode } from '@angular/core';
import { enableRxjsLeakDetector } from 'rxjs-leak-finder';

if (isDevMode()) {
  enableRxjsLeakDetector();
}

FAQ

Should I replace SubSink with rxjs-leak-finder?

No — they do different jobs. SubSink unsubscribes; rxjs-leak-finder detects leaks. If you want less teardown boilerplate, the modern move is takeUntilDestroyed() (built into Angular 16+), with rxjs-leak-finder verifying it.

Is SubSink still maintained?

It's stable and widely used but sees little new activity — expected for a single-purpose utility. Angular's native takeUntilDestroyed has largely superseded the need for it.