How to extract a Thread Dump from an Heap Dump

To troubleshoot a Java application it is common to analyze both Heap Dumps and Thread Dumps. In this article we will learn how to extract a Thread dump from an Heap Dump with some freely available tools like VisualVM.

Understanding Heap Dumps and Thread Dumps

  • Heap Dump: A snapshot of the Java Virtual Machine’s memory, capturing object details and their relationships.
  • Thread Dump: A snapshot of all the threads’ current states in a Java application, displaying their call stacks.

To learn how to generate an Heap Dump we recommend checking this article: How to generate an Heap Dump in Java

Steps to Extract Thread Dump from Heap Dump in VisualVM:

Step 1: Opening the Heap Dump in VisualVM

  1. Launch VisualVM: Start VisualVM and ensure you have the necessary plugins installed for heap dump analysis.
  2. Open Heap Dump File: Go to the “File” menu, select “Load” or “Open”, and navigate to the location where the heap dump (*.hprof) is saved. Load the heap dump into VisualVM.

Step 2: Analyzing Threads and Extracting Thread Dump

  1. Navigate to Threads View: Look for an option or tab related to “Threads” or “Thread Dumps” in VisualVM’s interface. It typically displays the running threads and their statuses.
  2. Reviewing Thread Dump:
    • VisualVM will display the extracted thread dump in a readable format, showcasing each thread’s call stack and state at the time the heap dump was taken.
    • Analyze the thread dump to identify any blocked, waiting, or problematic threads affecting the application’s performance or stability.
Extract Thread Dump from Heap Dump

Step 3: Analyzing and Troubleshooting

  1. Identifying Issues: Inspect the thread dump to pinpoint potential issues such as deadlocks, long-running threads, or threads stuck in a particular method.
  2. Performance Optimization: Use the information from the thread dump to optimize thread usage, identify bottlenecks, or rectify synchronization issues in the application.


VisualVM serves as an invaluable tool for extracting thread dumps from heap dumps, providing insights into an application’s runtime behavior. Leveraging VisualVM’s capabilities to extract and analyze thread dumps aids in diagnosing threading issues, enhancing application performance, and ensuring robustness.