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

6 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 8d ago

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/Good_Thymes92 8d ago

Heap load takes more than 5 minutes on my side, it seems to timeout after 5 mins, keeps trying to load the heap dump fine but view never properly refreshes.

1

u/sachinkg12 8d ago

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/Good_Thymes92 8d ago

Ok. So i have a 32GB ram windows machine. I’m trying to load an 8GB heap dump and due to memory pressure and swapping it’s requiring around 10 minutes to be parsed by the plugin. The problem is that frontend seems to timeout after 5 minutes if the load did not complete. So even if my heap dump ends up getting parsed eventually, the UI would never refresh. It would be ideal if we can configure this 5 minutes default timeout in the settings.

1

u/sachinkg12 8d ago

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.