Skip to content
aj-geddes avatar

Memory Leak Detection

Detects memory leaks in Node.js and Python using heap snapshots, profiling, and production monitoring.

CCM score
39 of 100
skills.sh installs
594
GitHub stars
396
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers investigating memory growth, OOM errors, and performance degradation through heap snapshots and memory profiling
  • Includes reference guides for Node.js heap snapshots, leak detection middleware, Python memory profiling, and WeakMap/WeakRef caching
  • Provides a MemoryProfiler class that writes V8 heap snapshots and prints RSS, heap, and external memory usage
  • Designed for developers diagnosing container restarts, high memory consumption, or unbounded cache growth

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill memory-leak-detection -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Memory Leak Detection

Table of Contents

Overview

Identify and fix memory leaks to prevent out-of-memory crashes and optimize application performance.

When to Use

  • Memory usage growing over time
  • Out of memory (OOM) errors
  • Performance degradation
  • Container restarts
  • High memory consumption

Quick Start

Minimal working example:

import v8 from "v8";
import fs from "fs";

class MemoryProfiler {
  takeSnapshot(filename: string): void {
    const snapshot = v8.writeHeapSnapshot(filename);
    console.log(`Heap snapshot saved to ${snapshot}`);
  }

  getMemoryUsage(): NodeJS.MemoryUsage {
    return process.memoryUsage();
  }

  formatMemory(bytes: number): string {
    return `${(bytes / 1024 / 1024).toFixed(2)} MB`;
  }

  printMemoryUsage(): void {
    const usage = this.getMemoryUsage();

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Category
Debugging
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258

Similar to Memory Leak Detection

More Debugging