Skip to content
Skills Library
Programming · Analysis

profiling-memory

/profiling-memory

Attribute memory growth and allocation churn to the exact call sites that produce it using an allocation profiler. Use when a process grows without bound, spends too much time in garbage collection, or allocates far more than its working set explains.

Repository
AI-SKILLS ↗
Licence
MIT
Last repository change
05.09.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 05.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Attribute memory growth and allocation churn to the exact call sites that produce it using an allocation profiler. Use when a process grows without bound, spends too much time in garbage collection, or allocates far more than its working set explains.

Original author description

Attribute memory growth and allocation churn to the exact call sites that produce it using an allocation profiler. Use when a process grows without bound, spends too much time in garbage collection, or allocates far more than its working set explains.

How it works

  1. Method
  2. Signals
  3. Boundaries
Original SKILL.md headings · 51 lines, 447 words
SKILL.md preview
---
name: profiling-memory
description: Attribute memory growth and allocation churn to the exact call sites that produce it using an allocation profiler. Use when a process grows without bound, spends too much time in garbage collection, or allocates far more than its working set explains.
---

# Profiling memory

Memory problems come in two flavors that look identical from the outside: you
keep objects you should have dropped, or you allocate and free at a furious
rate that the collector cannot keep up with. Total usage tells you something
is wrong; only an allocation profile tells you which line to change.

## Method

1. **Decide first: live growth or allocation rate.** A heap that climbs and
   never falls is retention. A flat heap with high garbage-collection CPU is
   churn: short-lived objects born and killed in a loop. Watch RSS over time
   and the GC pause log to tell them apart before choosing a tool.
2. **For retention, take two heap snapshots and diff them.** Capture one
   after warmup and one after the leak has grown: `jmap -dump` then Eclipse
   MAT for the JVM, `tracemalloc.take_snapshot().compare_to(...)` in Python,
   Chrome DevTools heap snapshots for Node. The diff names the object type and
   the retaining path that is holding it alive.
3. **For churn, run an allocation profiler that keeps stacks.** `memray run
   app.py` for Python, `async-profiler -e alloc` for the JVM, `heaptrack
   ./app` for native code. These sample allocations with the call stack, so
   the flame graph shows which call site allocated the bytes, not just how
   many.
4. **Rank by allocation count, not only by size.** A million tiny objects
   costs more in GC pressure than one large buffer of equal bytes. Sort the
   profile by number of allocations to find the loop creating temporaries:
   boxed integers, intermediate lists, format strings, defensive copies.
5. **Follow the dominator tree to the real owner.** In a snapshot, the object
   at the top of memory is often innocent; the dominator, the single node
   whose removal frees the whole subtree, is the cache, listener list, or
   static map that never releases. Break that one reference and the subtree
   collapses.
6. **Fix the site, then confirm the curve flattens.** Pool the buffer, reuse
   the object, drop the stale reference, or bound the cache. Rerun the same
   workload and watch RSS plateau or GC time fall; if the curve still climbs,
   the diff pointed at a symptom and a second retainer remains.

## Signals

- Can you name the type and the call site responsible for the most bytes?
- Does the retaining path lead to something you can legitimately release?
- After the fix, does RSS reach a steady state under the same load?

## Boundaries

Profilers attribute managed and instrumented allocations; memory lost by a C
extension or a raw `mmap` outside the runtime stays invisible, and native
leak detection (Valgrind, ASan, LeakSanitizer) covers that ground. This skill
locates allocation; whether an object should live that long is design.

Versions

The database has no other skills named profiling-memory.

Database snapshot: 13.11.2026 · package version 76ea2dbaa0f8 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90memory-optimization
    Cut a program's memory footprint by fixing data layout, reusing allocations, and streaming input instead of buffering it whole. Use when a process is killed by the OOM killer, garbage collection dominates the profile, or heap growth tracks input size.
  • 100jvm-gc-selection
    Choose and size a JVM garbage collector from latency goals and allocation behavior, and read GC logs before tuning flags. Use when configuring JVM services or diagnosing pause and memory pressure problems.
  • 100heaptrack
    heaptrack memory profiler skill for Linux. Use when tracking heap allocations, finding memory leaks, measuring peak heap usage, identifying allocation hotspots, or comparing allocation behaviour between runs. Activates on queries about heaptrack, heap profiling, memory…
  • 100unity-performance
    Unity 6 performance profiling and optimization guide. Use when profiling, optimizing frame rate, reducing memory usage, debugging performance bottlenecks, or using the Profiler, Memory Profiler, or Frame Debugger. Based on Unity 6.3 LTS documentation.
  • 87optimize-memory-allocation
    Analyze JVM memory-allocation profiles with zymtrace — find what allocates the most (bytes/objects), why GC is busy, and where allocation churn is burning CPU. **Java/JVM only** — zymtrace memory-allocation profiling is supported for the JVM; non-Java workloads have no…
  • 95nodejs-profiling
    Node.js performance profiling with V8 CPU profiler, heap analysis, and perf_hooks. Use for identifying bottlenecks and memory leaks. USE WHEN: user mentions "Node.js performance", "profiling", "memory leak", asks about "V8 profiler", "heap snapshot", "CPU profile", "perf_hooks",…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.