hmos-native-memleak-analysis

Diagnose HarmonyOS native memory leaks from sample, smaps, profiler, and kernel logs.

2|Updated Jun 21, 2026
One-click install
npx skills add https://github.com/IsKenKenYa/skills --skill hmos-native-memleak-analysis-iskenkenya
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hmos-native-memleak-analysis
Source: https://github.com/IsKenKenYa/skills/tree/main/skills/harmonyos/solutions/quality/stability/hmos-native-memleak-analysis
Command: npx skills add https://github.com/IsKenKenYa/skills --skill hmos-native-memleak-analysis-iskenkenya

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? HarmonyOS/OpenHarmony developers facing native memory leaks, continuous memory growth, or OOM issues must manually correlate sample files, smaps dumps, profiler flame graphs, and kernel logs—a slow, error-prone process. This Skill automates the entire root-cause analysis and produces a complete evidence chain. ## Core Features & Use Cases - Automated Leak Classification: Parses sample files to determine leak type (PSS, DMA, GPU) and further subdivides PSS leaks into jemalloc heap, ArkTS VM objects, ashmem, and anonymous memory. - Call-Stack Localization: Analyzes profiler/trace SQLite databases to pinpoint the leaking .so module and full function call path, and parses kernel logs for DMA/GPU/SLAB leaks with Top-N process breakdowns. - Structured Reports with Fault-Mode Matching: Matches findings against a three-level fault mode library and outputs a standardized analysis report with memory trend tables, evidence chains, root-cause modules, and fix suggestions. - Use Case: A developer receives a memleak log bundle after a RESOURCE_OVERLIMIT event; the Skill identifies a jemalloc heap leak, traces it to a specific allocation call stack in libface_detect.so, and delivers a ready-to-share diagnosis report. ## Quick Start Analyze the HarmonyOS native memory leak logs in my provided directory and tell me the leak type, root cause module, and fix suggestions.

Frequently Asked Questions about hmos-native-memleak-analysis

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

FAQPage Schema
How do I analyze a HarmonyOS native memory leak from log files?▼

Provide the directory containing memleak log files (sample, smaps, profiler, kernel). The Skill runs file_process.py to select the right files, then classifies the leak type and drills down into heap, DMA, or GPU analysis automatically.

What tools analyze PSS, DMA, and GPU memory leaks on OpenHarmony?▼

This Skill covers all three: sample.py measures memory growth trends and type ratios, native_parser.py breaks down jemalloc/ashmem allocations, kernel_leak.py parses kernel-side DMA/GPU/SLAB data, and flame_analyzer.py resolves leaking call stacks from profiler traces.

What input files does HarmonyOS native leak analysis require?▼

It accepts memleak-native sample and smaps files, profiler trace files, and memleak-kernel logs. If only kernel files exist, it switches to non-unified-control analysis; missing files are reported rather than assumed.

Does the analysis support ArkTS heap leaks?▼

It detects ArkTS VM object leaks from smaps ratios but cannot pinpoint the leaking objects. It will prompt you to capture a .heapsnapshot file and use a heap snapshot analysis skill for object-level diagnosis.

Why does kernel log parsing fail with an unsupported format error?▼

The parser recognizes memoryName, MM_DMABUF_INFO, LOGGER_PROCESS_DMABUF_INFO, and Process dma_heap info formats. If none match, it reports the detected markers instead of fabricating results, so check that the log is a valid memleak-kernel capture.

What Python dependencies are needed to run the analysis scripts?▼

The scripts require Python 3 and the dill package for deserializing parsed objects. Install dependencies with pip install -r requirements.txt from the repository root before running the analysis.