Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. The Developer Center continues to support Commerce 6.13.0 through 7.4.1.Visit new site

Getting a Heap Dump

Getting a Heap Dump

JVM heap dumps are used to diagnose memory and performance problems.

Automatic Heap Dumps

To set your server to generate heap dumps automatically when a heap out of memory error occurs:

  1. Open your server's startup script with a text editor.
  2. Modify JAVA_OPTS to include the following:
    -XX:+HeapDumpOnOutOfMemoryError
  3. Restart your server.

On Demand Heap Dumps

Elastic Path recommends using JMap for generating heap dumps on demand.

Note:

JMap will essentially stop your JVM throughput until it is complete; and it may take 10+ minutes.

  1. Make sure your server is running.
  2. With the command prompt, get your server's Java PID using the following command:
    jps -l
    Note:

    Your server's PID will be identified by one of the Java class names listed in this table:

    Server Classname
    Tomcat 9.0 org.apache.catalina.startup.Bootstrap start
  3. Run the following command to generate a heap.bin file in your current directory.
    jmap -heap:format=b <java_pid>
Note: Analyzing the Heap Dump

Elastic Path recommends you use either the Eclipse "Memory Analyzer Tool" plugin or IBM's HeapAnalyzer for analyzing heap.bin.