python-memory-leak-analyzer

Analyzes Python process memory growth to identify root causes of leaks.

3|2|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/openeuler-mirror/witty-diagnosis-agent --skill python-memory-leak-analyzer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-memory-leak-analyzer
Source: https://github.com/openeuler-mirror/witty-diagnosis-agent/tree/main/skills/python-memory-leak-analyzer
Command: npx skills add https://github.com/openeuler-mirror/witty-diagnosis-agent --skill python-memory-leak-analyzer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill resolves complex memory growth issues in Python services by distinguishing between genuine retained leaks, native allocator fragmentation, and file-backed memory usage.

Core Features & Use Cases

  • Multi-Layered Diagnosis: Correlates RSS growth with Python heap snapshots, native allocation patterns, and semantic retention chains.
  • Safety-First Analysis: Operates in a read-only mode by default, ensuring production stability while providing deep diagnostic insights.
  • Use Case: When a production Python service experiences OOM kills or continuous RSS growth, use this Skill to identify whether the root cause is a global container leak, a closure retaining frames, or native C-extension memory growth.

Quick Start

Use the python-memory-leak-analyzer skill to discover evidence and analyze the memory growth for the process with PID 1234.

Frequently Asked Questions about python-memory-leak-analyzer

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

FAQPage Schema
How do I diagnose a Python memory leak causing continuous RSS growth?

To diagnose a Python memory leak causing continuous RSS growth, you must correlate process-level memory metrics with Python heap snapshots. This distinguishes whether the root cause is retained objects, native allocator fragmentation, or file-backed mapping expansion.

Why does my Python service keep getting OOM killed in production?

Your Python service is getting OOM killed due to unbounded memory growth from global container leaks, closures retaining frames, or native C-extension expansion. Analyzing semantic retention chains and native allocation patterns isolates the specific trigger.

How do I distinguish between native memory leaks and Python object retention?

Distinguishing native memory leaks from Python object retention requires correlating RSS growth with native allocation patterns and semantic retention chains. This multi-layered diagnosis maps heap snapshots against process-level memory metrics to isolate the leak source.

Can I analyze memory fragmentation in a production Python service safely?

You can safely analyze memory fragmentation in a production Python service because the diagnostic operates in a read-only mode by default. It accesses the /proc filesystem and standard diagnostic tools without modifying the running process, ensuring production stability.

What do I need to troubleshoot Python memory growth using the /proc filesystem?

To troubleshoot Python memory growth using the /proc filesystem, you need access to the target process PID and standard Python diagnostic tools. This allows the analysis to read process-level memory metrics and correlate them with heap snapshots.