aj-geddes avatar

Memory Leak Detection

This handles the detective work of tracking down memory leaks in Node.js and Python apps. You get heap snapshot utilities, profiling helpers, and middleware to monitor memory growth over time. The reference guides cover the usual suspects: event listeners that never detach, forgotten timers, cache bloat, and circular references. It pushes WeakMap and WeakRef pretty hard for caching, which is the right call if you're holding references to objects you don't fully control. Most useful when you're debugging OOM crashes or watching container memory creep up in production. The monitoring patterns are more practical than the basic profiler examples.

skills.sh installs
589
GitHub stars
379
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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();

Sponsors

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
AI & Agent Building, Debugging
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258
1humanizerai avatarreadabilityhumanizerai/agent-skillsAnalyze text readability with Flesch-Kincaid, Gunning Fog, SMOG, and other metrics. Returns objective scores with interpretation and recommendations.589skills.sh installs
2openai avatarslidesopenai/skillsCreate and edit presentation slide decks (`.pptx`) with PptxGenJS, bundled layout helpers, and render/validation utilities. Use when tasks involve building a ne589skills.sh installs
3aj-geddes avatardatabase-backup-restoreaj-geddes/useful-ai-promptsImplement backup and restore strategies for disaster recovery. Use when creating backup plans, testing restore procedures, or setting up automated backups.588skills.sh installs
4jwynia avatarinteractive-fictionjwynia/agent-skillsDiagnose branching narrative problems. Use when choices feel meaningless, when branching is unmanageable, when player agency conflicts with authored story, or w587skills.sh installs
5getsentry avatarsentry-react-sdkgetsentry/sentry-agent-skillsFull Sentry SDK setup for React. Use when asked to "add Sentry to React", "install @sentry/react", or configure error monitoring, tracing, session replay, profi586skills.sh installs
6plugin87 avatardesign-tokensplugin87/ux-ui-agent-skillsGenerate, extend, or audit design tokens in DTCG format with the 3-tier architecture (primitive → semantic → component). Use when the user wants a color palette585skills.sh installs