Isurwars/Correlation / .agents/skills/memory-profiling
memory-profiling
UnverifiedHeap and memory footprint analysis using Valgrind Memcheck, Massif, and Heaptrack for large trajectory data processing. Use when diagnosing memory leaks or memory bloat.
Memory Profiling & Heap Analysis
This skill provides protocols for inspecting, profiling, and optimizing heap memory usage during large trajectory analysis runs.
1. Tool Availability & Preflight
Before executing memory profiling tools, check if they are installed on the system:
command -v valgrind || echo "valgrind not found"
command -v heaptrack || echo "heaptrack not found"
If neither tool is installed, fall back to AddressSanitizer / LeakSanitizer via the repository preset:
cmake --preset asan && cmake --build --preset asan && ./build-asan/src/correlation <input_file> --r-max 10.0
2. Valgrind Memcheck Protocol
Detect uninitialized memory reads and heap leaks:
valgrind --tool=memcheck \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
--log-file=memcheck.log \
./build/src/correlation trajectory.xyz -o output --r-max 10.0
3. Heaptrack Peak Memory Profiling
Track peak allocation hotspots during trajectory parsing:
heaptrack ./build/src/correlation trajectory.xyz -o output --r-max 10.0
heaptrack_print heaptrack.correlation.*.gz
4. High-Throughput Memory Guidelines
- Avoid Allocations in Loop Hotspots: Pre-allocate
std::vector::reserve()outside iteration loops. - Buffer Reuse: Pass reusable
std::vectorbuffers by reference to avoid repetitive heap allocation/deallocation overhead. - Move Semantics: Use
std::movewhen transferring large trajectory frames or distribution profile arrays.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 192k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 192k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 192k | Updated | Claude CodeCodex | Verified | Install |