A privacy-focused, client-side web application for analyzing Java heap dumps (.hprof files). All parsing and analysis happens entirely in your browserβno data ever leaves your machine.
Your data never leaves your browser. This application:
- Runs completely client-side using JavaScript
- Does not make any network requests with your heap dump data
- Does not upload files to any server
- Processes everything locally in your browser
- π Multi-File Analysis: Upload and compare multiple heap dumps
- π Upload multiple .hprof files simultaneously via drag-drop or file selector
- π File selector dropdown to switch between individual heap dumps
- π Consolidated Analysis tab showing patterns across all files
- π Trend indicators showing memory growth/decline across files
- π Persistent leak detection highlighting issues appearing in most files
- π Object Histogram: View class names, instance counts, and total memory usage
- π Click any class row for detailed insights and resolution guidance
- π Comparative indicators when multiple files loaded (ββ trend arrows)
- π³ Dominator Tree: Analyze retained heap size by class
- π Click any class row for detailed insights and resolution guidance
- π Retention trends across multiple files
- π Reference Chains: Trace who holds references to large objects
- π Leak Suspects: Automatic detection of classes with unusually high retained size or instance count
- π Click class names for detailed insights
- π Direct links to troubleshooting resources and professional tools
- π Persistent leak highlighting for issues appearing in 70%+ of files
- π Consolidated View: Cross-file analysis and insights
- π Common leak suspects appearing in multiple files
- π Consistent memory consumers with variance analysis
- π Instance count trends (growing/shrinking classes)
- π Actionable insights and recommendations based on multi-file patterns
- π‘ Insights: Identify common leak patterns:
- Retained batch strings
- Uncollected collections
- Classloader leaks
- Event listener accumulation
- ThreadLocal leaks
- Database resource leaks
- π 15+ recognized Java classes with specific guidance
- π Pattern-based detection for custom classes
- π Built-in Knowledge Base:
- π Detailed information for common Java classes
- π Common memory issues and why they occur
- π Recommended actions with step-by-step guidance
- π Direct links to official documentation (Java, Baeldung, Oracle)
- π Links to professional tools (Eclipse MAT, VisualVM)
- π Search & Filter: Sort and search through objects efficiently
- π± Responsive Design: Works on desktop and mobile browsers
- π― Actionable Guidance: Know exactly what to fix and in what priority
- Node.js (v18 or higher recommended)
- npm or yarn
# Clone the repository
git clone https://github.com/deepwired/java-heap-dump-analyser.git
cd java-heap-dump-analyser
# Install dependencies
npm install
# Start the development server
npm startThe application will open at http://localhost:5173
Single File Analysis:
- Click "Choose File(s)" or drag and drop a
.hproffile - Wait for the file to be parsed (this happens in your browser)
- Explore the analysis results:
- Histogram Tab: See all classes sorted by memory usage
- Dominator Tree Tab: View retained heap by class
- Leak Suspects Tab: Review automatically detected potential memory leaks
Multi-File Comparison:
- Click "Choose File(s)" and select multiple
.hproffiles, or drag and drop multiple files - Wait for all files to be parsed
- Use the file selector dropdown to switch between individual heap dumps
- Explore the Consolidated Analysis tab to:
- View common leak suspects appearing across files
- Identify classes with consistent high memory usage
- Analyze instance count trends (growing/shrinking)
- Get actionable insights based on multi-file patterns
- In individual tabs (Histogram, Dominator Tree, Leak Suspects):
- See trend indicators (ββ) comparing current file to average
- View file presence badges showing how many files contain each class
- Identify persistent leaks highlighted across multiple files
npm run buildThe built files will be in the dist/ directory. You can serve them with any static file server.
To create a heap dump from a running Java application:
# Using jmap (requires JDK)
jmap -dump:format=b,file=heap.hprof <pid>
# Using jcmd (requires JDK)
jcmd <pid> GC.heap_dump heap.hprof
# Automatic dump on OutOfMemoryError
java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heap.hprof YourApp- React 19: UI framework
- Vite: Build tool and dev server
- Pure JavaScript: HPROF parser implementation
The parser is implemented in pure JavaScript to run entirely in the browser. It supports:
- HPROF format version 1.0.3 (Java 11+)
- Common record types: CLASS, INSTANCE, OBJECT_ARRAY, PRIMITIVE_ARRAY
- GC root records for dominator tree analysis
- String records for efficient memory usage
- Histogram: Aggregates instances by class with counts and shallow sizes
- Dominator Tree: Calculates retained heap using GC root traversal
- Reference Chains: Breadth-first search from GC roots to target objects
- Leak Detection: Statistical analysis of retained sizes and common patterns
This tool is designed to detect common JVM memory leak patterns, especially those seen in observability pipelines:
Large numbers of string objects held in collections, often from log processing or event batching.
HashMap, ArrayList, or other collections that grow unbounded due to missing cleanup logic.
Applications or modules that fail to unload, retaining entire class graphs and static fields.
Event listeners or callbacks that are registered but never removed.
Contributions are welcome! Here's how to extend the analyzer:
- Create a new analyzer in
src/services/analyzers/ - Implement the analysis logic using the parsed heap data
- Add UI components in
src/components/ - Update the main App.jsx to include your feature
The parser is in src/services/hprofParser.js. To add support for new record types:
- Add the record type constant
- Implement the parser for that record type
- Update the data structures to store the new information
- Add tests for the new format
The current parser handles common JVM heap dump formats. For advanced scenarios:
- Consider integrating WebAssembly ports of Eclipse MAT
- Add support for compressed heap dumps
- Implement incremental parsing for very large files
# Run linter
npm run lint
# Build the project
npm run build
# Preview production build
npm run previewCreate test heap dumps using the provided test program:
// TestMemoryLeak.java
import java.util.*;
public class TestMemoryLeak {
private static List<String> leak = new ArrayList<>();
public static void main(String[] args) throws Exception {
for (int i = 0; i < 100000; i++) {
leak.add("Leaked string " + i);
}
System.out.println("Press Enter to dump heap...");
System.in.read();
}
}Compile and run:
javac TestMemoryLeak.java
java TestMemoryLeak
# In another terminal: jmap -dump:format=b,file=test.hprof <pid>Licensed under the Apache License, Version 2.0. See LICENSE file for details.
Inspired by:
This application is designed with security in mind:
- No external network requests are made
- All processing happens client-side
- No data is stored or transmitted
- No dependencies with known vulnerabilities
If you find a security issue, please report it via GitHub Issues.
For issues, questions, or contributions:
- Open an Issue
- Submit a Pull Request