npx skills add smithery/aj-geddes --skill memory-leak-detection
aj-geddes/useful-ai-prompts
memory-leak-detection
Detect and fix memory leaks using heap snapshots, memory profiling, and leak detection tools. Use when investigating memory growth, OOM errors, or optimizing memory usage.
Installation
npx skills add aj-geddes/useful-ai-prompts --skill memory-leak-detection
Similar popular skills
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Deploy and operate the RTVI-CV-3D microservice as MV3DT (`MODE=mv3dt`): per-camera DeepStream p…
1.8K installsUse this skill when the user wants to deploy, run, debug, tear down, or call the REST API of th…
1.8K installsAutomates the end-to-end detection engineering workflow in Google SecOps using MCP tools. Use w…
4K installsCreate, tune, and manage Elastic Security detection rules (SIEM and Endpoint). Use for false po…
2.9K installsElastic ML anomaly detection — investigation/RCA, score explanation, job lifecycle troubleshoot…
2.1K installsIdentify a .NET project's test platform, framework, command mode, and SDK-style vs classic proj…
1.6K installsAlso in this package
Other skills from aj-geddes/useful-ai-prompts · top by installs.
npx skills add aj-geddes/useful-ai-prompts
More details
Agent compatibility
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Also listed on
Alternate registries and mirrors of this skill.
Repository health
main
Package contents
Files included with this skill beyond the listing page.
-
skill md
SKILL.md2,741 B -
docs
SUMMARY.md2,634 B
History
- First seen on skills.sh
- First recorded snapshot · 551 installs
SKILL.md
Memory Leak Detection
Table of Contents
- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)
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();
console.log("Memory Usage:");
console.log(` RSS: ${this.formatMemory(usage.rss)}`);
console.log(` Heap Total: ${this.formatMemory(usage.heapTotal)}`);
console.log(` Heap Used: ${this.formatMemory(usage.heapUsed)}`);
console.log(` External: ${this.formatMemory(usage.external)}`);
// ... (see reference guides for full implementation)
Reference Guides
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| [Node.js Heap Snapshots](references/nodejs-heap-snapshots.md) | Node.js Heap Snapshots |
| [Memory Leak Detection Middleware](references/memory-leak-detection-middleware.md) | Memory Leak Detection Middleware |
| [Common Memory Leak Patterns](references/common-memory-leak-patterns.md) | Common Memory Leak Patterns |
| [Python Memory Profiling](references/python-memory-profiling.md) | Python Memory Profiling |
| [WeakMap/WeakRef for Cache](references/weakmapweakref-for-cache.md) | WeakMap/WeakRef for Cache |
| [Memory Monitoring in Production](references/memory-monitoring-in-production.md) | Memory Monitoring in Production |
Best Practices
✅ DO
- Remove event listeners when done
- Clear timers and intervals
- Use WeakMap/WeakRef for caches
- Limit cache sizes
- Monitor memory in production
- Profile regularly
- Clean up after tests
❌ DON'T
- Create circular references
- Hold references to large objects unnecessarily
- Forget to clean up resources
- Ignore memory growth
- Skip WeakMap for object caches