Node Memory Profiler
A guide to finding and fixing memory leaks in Node.js applications using profiling tools and heap analysis.
Usage
Ask about memory profiling, heap snapshots, leak detection, or memory optimization.
Examples
- "Take and compare heap snapshots to find a memory leak"
- "How do I use clinic.js to profile memory usage?"
- "Fix a memory leak caused by event listeners"
Guidelines
- Take heap snapshots before and after the suspected leak operation
- Look for growing object counts in snapshot comparisons
- Remove event listeners when they are no longer needed
- Avoid storing large data in module-level closures
- Use WeakMap and WeakRef for caches that should be garbage collected