You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
leakThreshold: 10, // Report after 10 unmatched mounts
85
-
});
95
+
const tracker =createMemoryTracker();
96
+
97
+
// Register a resource (component mount, subscription, etc.)
98
+
tracker.track('ContactList', () =>cleanup());
99
+
100
+
// Unregister when done (component unmount, unsubscribe)
101
+
tracker.untrack('ContactList');
86
102
87
-
// Track component lifecycle
88
-
tracker.onMount('ContactList');
89
-
tracker.onUnmount('ContactList');
103
+
// Report entries tracked longer than 30s (potential leaks)
104
+
const leaks =tracker.reportLeaks(30_000);
90
105
91
-
//Check for leaks
92
-
const leaks =tracker.getLeaks();
106
+
//Clean up all tracked entries
107
+
tracker.disposeAll();
93
108
```
94
109
95
-
Tracks component mounts, subscriptions, and event listeners. Reports potential memory leaks when unmount counts don't match mount counts above a configurable threshold.
110
+
Tracks component mounts, subscriptions, and event listeners. Entries that remain tracked beyond the threshold are reported as potential leaks in development builds.
0 commit comments