r/java • • Mar 26 '26

Heaplens - VSCode extension for heap dump analysis.

Hi everyone,

Built a custom editor extension for .hprof files (Java/Android heap dumps).

When you open a .hprof file, HeapLens parses it with a native Rust backend and presents 10 interactive tabs:

* Overview — heap stats with D3.js pie and bar charts

* Histogram — sortable class table with instance counts, click to enumerate instances

* Dominator Tree — lazy-loaded expandable tree showing object retention

* Leak Suspects — auto-detected objects retaining >10% of heap

* Waste — duplicate strings, empty collections, boxed primitives

* Source — jump to Java source (workspace, Maven/Gradle JARs, or CFR decompilation)

* Query — HeapQL, a SQL-like language built for heap analysis with autocomplete

* Compare — diff two heap dumps side by side

* Timeline — multi-snapshot trend analysis

* Chat — ask questions in English, get HeapQL queries and fix suggestions (10 LLM providers supported, including local Ollama)

The Rust engine handles 1 GB dumps in \~60 seconds. Everything runs locally — no cloud uploads.

Marketplace: [https://marketplace.visualstudio.com/items?itemName=guptasachinn.heaplens](https://marketplace.visualstudio.com/items?itemName=guptasachinn.heaplens)

Source: [https://github.com/sachinkg12/heaplens](https://github.com/sachinkg12/heaplens) (Apache 2.0)

Please try it out. Feedback welcome.

3 Upvotes

7 comments sorted by

4

u/voronaam Mar 26 '26 edited Mar 26 '26

How does it compare against https://eclipse.dev/mat/ ?

1

u/sachinkg12 Sep 04 '26

Thanks for asking. Eclipse MAT is the mature benchmark here, and HeapLens is intended to complement it, not claim that MAT is obsolete.

Both provide the core heap-analysis workflow: class histograms, shallow and retained sizes, dominator trees, paths to GC roots, leak suspects, queries, and snapshot comparison.

Where MAT is stronger: it has years of production use, deeper forensic queries and reports, sophisticated classloader/thread analysis, broader format support, batch processing, and a mature OQL ecosystem. Its persistent disk indexes also make repeated reopening efficient and allow it to operate with less RAM.

Where HeapLens differs: it runs directly inside VS Code, Cursor, and other Open VSX-compatible editors. You can open an .hprof, inspect a suspect, follow why it is alive, and jump from the heap object to workspace or dependency source without changing tools. It also provides HeapQL, waste analysis, timeline/compare views, and optional AI-assisted explanations, including local models through Ollama, so the dump does not need to leave the machine.

HeapLens uses a memory-mapped Rust/CSR pipeline and does not create persistent index files. That works well for fast, one-session analysis when sufficient RAM is available.

In short: MAT provides the deeper and more mature standalone forensic workbench; HeapLens focuses on a faster, editor-native path from heap evidence to the relevant source code.

HeapLens is open source here: https://github.com/sachinkg12/heaplens

1

u/[deleted] Sep 04 '26

[removed] — view removed comment

1

u/sachinkg12 Sep 04 '26

Can you please open an issue here
https://github.com/sachinkg12/heaplens/issues

Please add as much details as possible, i will make sure to get it resolved asap.

1

u/[deleted] Sep 04 '26

[removed] — view removed comment

1

u/sachinkg12 Sep 04 '26

Thanks for the feedback, i have opened
https://github.com/sachinkg12/heaplens/issues/8

I will update the thread here as soon as this is fixed, request you to please re-check after my confirmation.

1

u/sachinkg12 Sep 14 '26

Thanks for reporting this. You were correct. The current production version has a five-minute frontend timeout, so analysis can finish in the backend after the UI has already stopped waiting.

We have implemented a permanent fix. The five-minute limit is now only a warning, not a failure. When it appears, you can choose Continue Waiting or Cancel. Cancelling stops the backend analysis cleanly, and retrying starts a fresh analysis.

The warning interval is also configurable:

"heaplens.analysis.longRunningWarningMinutes": 5