detecting-memory-leaks

Detect potential memory leaks and analyze memory usage patterns in code. Use when troubleshooting performance issues related to memory growth or identifying leak sources. Trigger with phrases like "detect memory leaks", "analyze memory usage", or "find memory issues".

1,868 stars

Best use case

detecting-memory-leaks is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Detect potential memory leaks and analyze memory usage patterns in code. Use when troubleshooting performance issues related to memory growth or identifying leak sources. Trigger with phrases like "detect memory leaks", "analyze memory usage", or "find memory issues".

Teams using detecting-memory-leaks should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/detecting-memory-leaks/SKILL.md --create-dirs "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/plugins/performance/memory-leak-detector/skills/detecting-memory-leaks/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/detecting-memory-leaks/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How detecting-memory-leaks Compares

Feature / Agentdetecting-memory-leaksStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Detect potential memory leaks and analyze memory usage patterns in code. Use when troubleshooting performance issues related to memory growth or identifying leak sources. Trigger with phrases like "detect memory leaks", "analyze memory usage", or "find memory issues".

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Memory Leak Detector

Detect and diagnose memory leaks in Node.js, Python, and JVM applications by analyzing event listeners, closures, unbounded caches, and retained references.

## Overview

This skill helps you identify and resolve memory leaks in your code. By analyzing your code for common memory leak patterns, it can help you improve the performance and stability of your application.

## How It Works

1. **Initiate Analysis**: The user requests memory leak detection.
2. **Code Analysis**: The plugin analyzes the codebase for potential memory leak patterns.
3. **Report Generation**: The plugin generates a report detailing potential memory leaks and recommended fixes.

## When to Use This Skill

This skill activates when you need to:
- Detect potential memory leaks in your application.
- Analyze memory usage patterns to identify performance bottlenecks.
- Troubleshoot performance issues related to memory leaks.

## Examples

### Example 1: Identifying Event Listener Leaks

User request: "detect memory leaks in my event handling code"

The skill will:
1. Analyze the code for unremoved event listeners.
2. Generate a report highlighting potential event listener leaks and suggesting how to properly remove them.

### Example 2: Analyzing Cache Growth

User request: "analyze memory usage to find excessive cache growth"

The skill will:
1. Analyze cache implementations for unbounded growth.
2. Identify caches that are not properly managed and recommend strategies for limiting their size.

## Best Practices

- **Code Review**: Always review the reported potential leaks to ensure they are genuine issues.
- **Regular Analysis**: Incorporate memory leak detection into your regular development workflow.
- **Targeted Analysis**: Focus your analysis on specific areas of your code that are known to be memory-intensive.

## Integration

This skill can be used in conjunction with other performance analysis tools to provide a comprehensive view of application performance.

## Prerequisites

- Access to application source code in ${CLAUDE_SKILL_DIR}/
- Memory profiling tools (valgrind, heapdump, etc.)
- Understanding of application memory architecture
- Runtime environment for testing

## Instructions

1. Analyze code for common memory leak patterns
2. Identify unremoved event listeners and callbacks
3. Check for unbounded cache growth
4. Review closure usage and retained references
5. Generate report with leak locations and severity
6. Provide remediation recommendations

## Output

- Memory leak detection report with file locations
- Pattern analysis for event listeners and caches
- Memory usage trends and growth patterns
- Code snippets highlighting potential leaks
- Recommended fixes with code examples

## Error Handling

If memory leak detection fails:
- Verify code file access permissions
- Check profiling tool installation
- Validate code syntax and structure
- Ensure sufficient memory for analysis
- Review runtime environment configuration

## Resources

- Memory profiling tool documentation
- Memory leak detection best practices
- JavaScript/Node.js memory management guides
- Performance optimization resources

Related Skills

detecting-sql-injection-vulnerabilities

1868
from jeremylongshore/claude-code-plugins-plus-skills

Detect and analyze SQL injection vulnerabilities in application code and database queries. Use when you need to scan code for SQL injection risks, review query construction, validate input sanitization, or implement secure query patterns. Trigger with phrases like "detect SQL injection", "scan for SQLi vulnerabilities", "review database queries", or "check SQL security".

memory-kit

1868
from jeremylongshore/claude-code-plugins-plus-skills

Persistent context management for Claude Code sessions. Save, load, update, share, and audit session memory via MEMORY.md. Prevents context loss on compaction or session restart. Use when starting a session, before compaction, syncing context across teammates, or pruning stale memory entries. Trigger with "save memory", "load memory", "memory audit", "memory share".

detecting-performance-regressions

1868
from jeremylongshore/claude-code-plugins-plus-skills

Automatically detect performance regressions in CI/CD pipelines by comparing metrics against baselines. Use when validating builds or analyzing performance trends. Trigger with phrases like "detect performance regression", "compare performance metrics", or "analyze performance degradation".

detecting-performance-bottlenecks

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute this skill enables AI assistant to detect and resolve performance bottlenecks in applications. it analyzes cpu, memory, i/o, and database performance to identify areas of concern. use this skill when you need to diagnose slow application performance, op... Use when optimizing performance. Trigger with phrases like 'optimize', 'performance', or 'speed up'.

detecting-infrastructure-drift

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute use when detecting infrastructure drift from desired state. Trigger with phrases like "check for drift", "infrastructure drift detection", "compare actual vs desired state", or "detect configuration changes". Identifies discrepancies between current infrastructure and IaC definitions using terraform plan, cloudformation drift detection, or manual comparison.

detecting-database-deadlocks

1868
from jeremylongshore/claude-code-plugins-plus-skills

Process use when you need to work with deadlock detection. This skill provides deadlock detection and resolution with comprehensive guidance and automation. Trigger with phrases like "detect deadlocks", "resolve deadlocks", or "prevent deadlocks".

memory

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute extract and use project memories from previous sessions for context-aware assistance. Use when recalling past decisions, checking project conventions, or understanding user preferences. Trigger with phrases like "remember when", "like before", or "what was our decision about".

detecting-data-anomalies

1868
from jeremylongshore/claude-code-plugins-plus-skills

Process identify anomalies and outliers in datasets using machine learning algorithms. Use when analyzing data for unusual patterns, outliers, or unexpected deviations from normal behavior. Trigger with phrases like "detect anomalies", "find outliers", or "identify unusual patterns".

memorystore-config

1868
from jeremylongshore/claude-code-plugins-plus-skills

Memorystore Config - Auto-activating skill for GCP Skills. Triggers on: memorystore config, memorystore config Part of the GCP Skills skill category.

memory-profiler-setup

1868
from jeremylongshore/claude-code-plugins-plus-skills

Memory Profiler Setup - Auto-activating skill for Performance Testing. Triggers on: memory profiler setup, memory profiler setup Part of the Performance Testing skill category.

schema-optimization-orchestrator

1868
from jeremylongshore/claude-code-plugins-plus-skills

Multi-phase schema optimization workflow orchestrator. Creates session directories, spawns phase agents sequentially, validates outputs, aggregates results. Trigger: "run schema optimization", "optimize schema workflow", "execute schema phases"

test-skill

1868
from jeremylongshore/claude-code-plugins-plus-skills

Test skill for E2E validation. Trigger with "run test skill" or "execute test". Use this skill when testing skill activation and tool permissions.