leak_graph 0.2.1
leak_graph: ^0.2.1 copied to clipboard
Pure-Dart library for loading VM heap snapshots and analysing object retaining paths to surface memory leaks.
0.2.1 #
- Docs + packaging only (no library code change from 0.2.0): rewritten README
(standalone-first framing; documents
classRootProfiles, JSON round-trip, and the CLI) and expose theleak_capturecommand viaexecutables:. 0.2.0 shipped the same code but with a stale README and without the executable entry.
0.2.0 #
GraphAnalysisResult.classRootProfiles— aClassRootProfilefor EVERY class reachable from the GC root (not just leak-prone-rooted clusters), grouping each class's instances by theRootKindof their closest retaining root. Lets a UI separate live-UI-tree classes from leak-prone ones instead of only ever seeing leak candidates. A bounded subset of classes (the largest by instance count, plus any class with a leak-prone instance) also gets a representative shortest retaining path.toJson/fromJsononClassCount,GraphHop,GraphRetainingPath,GraphLeakCluster,GraphAnalysisStats,GraphAnalysisResult, and the newClassRootProfile— a full analysis run can now round-trip through JSON for snapshot export.computeDiff— diffs two class histograms into per-class instance/byte deltas (growth and shrinkage), backing snapshot-to-snapshot comparison.- Standalone heap-growth and retaining-path analysis directly from an on-device heap snapshot — no live VM-service connection required.
- Command-line heap dumper for capturing snapshots off a running app:
bin/capture.dart(run viadart run leak_graph:capture) — connects to a VM Service URI, streams a rawdartheapsnapshot to a file, and can optionally run the analysis in the same pass.tool/heapdump.sh— a standalone bash + adb + python3 dumper (no Dart toolchain) that discovers the VM Service URL from logcat, forwards the port, and streams the samedartheapfile straight off an Android device.
0.1.0 #
Initial release.
Pure-Dart heap-snapshot analysis: load a VM heap snapshot, build an object graph, and find the retaining paths that keep suspected leaks alive — with no dependency on a live VM-service connection.
heapGraphFromBytes/loadHeapGraph— parse a.dataheap snapshot (e.g. fromNativeRuntime.writeHeapSnapshotToFile) into aHeapGraphView. Never throws on malformed input; returns a sentinel graph instead.GraphLeakAnalyzer.analyze— the end-to-end pipeline: BFS shortest retaining paths, leak-prone root classification (timer / stream / closure / finalizer / static), app-relevance filtering, optional live-tree confirmation, and clustering by retaining-path signature. Each leak is attributed to the deepest app-owned object on its path, with the SDK chain kept as detail.retainingPathForClass(graph, className)— shortest retaining path to the first reachable instance of a class (standalone, no VM service).HeapGraphView.classHistogram()— per-class instance counts derived from the snapshot, for VM-service-free heap-growth detection.bin/analyze.dart— CLI that analyses a heap-snapshot file and renders a report.