ns-advanced-memory-leak-hunter

Diagnoses Node.js memory leaks by comparing baseline and peak N|Solid heap sampling profiles.

6|7|Updated Jun 4, 2026
One-click install
npx skills add https://github.com/nodesource/nsolid-plugin --skill ns-advanced-memory-leak-hunter-nodesource
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ns-advanced-memory-leak-hunter
Source: https://github.com/nodesource/nsolid-plugin/tree/main/skills/ns-advanced-memory-leak-hunter
Command: npx skills add https://github.com/nodesource/nsolid-plugin --skill ns-advanced-memory-leak-hunter-nodesource

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Node.js applications with recurring or staircase memory growth are hard to diagnose from a single heap snapshot. This Skill isolates the exact constructors, closures, and retainer paths responsible for retained memory by comparing baseline and peak heap evidence captured through N|Solid. ## Core Features & Use Cases - Baseline vs Peak Delta Analysis: Captures two heap sampling profiles and computes which constructors grew the most between them, distinguishing staircase leaks from normal sawtooth garbage collection. - Root Cause Extraction: Pulls the leaking function's source code via runtime-code using scriptId, line, and column locations, then proposes an optimized fix after user approval. - Structured Reporting: Produces a markdown leak report with baseline, peak, delta tables, root cause, and recommendations, optionally saved under .nsolid/assets/. - Use Case: A production service shows RSS climbing 50 MB per hour and never returning to baseline. The Skill captures a 30-second baseline sample, monitors metrics-historic for the staircase pattern, captures a 60-second peak sample, and pinpoints the closure retaining objects. ## Quick Start Ask the agent to hunt down the memory leak in your N|Solid-monitored application by comparing baseline and peak heap profiles.

Frequently Asked Questions about ns-advanced-memory-leak-hunter

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find a memory leak in a Node.js application?▼

Capture a baseline heap sample, monitor RSS and heapUsed metrics for a staircase growth pattern, then capture a peak heap sample and compare the two profiles. The constructors with the largest growth between baseline and peak reveal the leaking objects.

How to compare two heap snapshots to find retained objects?▼

Take a low-overhead heap sample at a known baseline state and another at peak memory, then run a delta analysis on the top allocating constructors. Growth in specific constructors or closures between the two profiles identifies what is being retained.

What is the difference between sawtooth and staircase memory patterns?▼

A sawtooth pattern shows heapUsed rising and falling back to baseline, indicating normal garbage collection. A staircase pattern shows heapUsed never returning to its original baseline, indicating unreleased memory and a likely leak.

Why does heap profile analysis fail with track-heap-objects assets?▼

The asset-summary tool does not support heap-profile assets produced by track-heap-objects, so they cannot be analyzed in this workflow. Baseline and peak captures must always use heap-sampling, which produces analyzable heap sample assets.

Can I reuse existing heap snapshots instead of capturing new ones?▼

Yes. If you already have baseline and peak evidence, the workflow skips capture and goes straight to delta analysis. Locally downloaded assets in .nsolid/assets/ are also reused instead of being re-downloaded.

Why does runtime code extraction fail for a leaking function?▼

Extraction fails when the scriptId is 0 or when the process runs inside Docker with a mismatched file path. The workflow allows up to two path adjustments for Docker cases, after which you must supply the source code manually.