Heap dumps in JDK 11



For generating heap dumps on JDK 11 is pretty straight forward, following the previous versions – just add the flag when calling java:



[@your_computer] java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/JDK11/java_application

Generated file

The generated file will be java_pid[number].hprof


For testing, I used the scripts from here

Actually, the second example is pretty straight forward –  Error 2 – GC Overhead limit exceeded 

// Java program to illustrate
// GC Overhead limit exceeded
import java.util.*;
public class Wrapper {
public static void main(String args[]) throws Exception
        Map m = new HashMap();
        m = System.getProperties();
        Random r = new Random();
        while (true) {
            m.put(r.nextInt(), "randomValue");
  But I didn’t run with his suggestion and instead, run it without it. Just to see how long it would take. I regretted because the file is huge!



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s