Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: details on using jvisualvm


  • Run JVM with -XX:+HeapDumpOnOutOfMemoryError so that JVM will automatically produce a heap dump when it hits OutOfMemoryError.
  • You can run jmap -heapdump:format=b live,file=/tmp/jenkins.hprof pid where pid is the process ID of the target Java process. Please only do this if you use Java6, as earlier versions have issues.
  • Use VisualVM, attach to the running instance, and obtain a heap dump
  • If your Jenkins runs at http://server/jenkins/, request http://server/jenkins/heapDump with your browser and you'll get the heap dump downloaded. (1.395 and newer)
  • If you are familiar with one of many Java profilers, they normally offer this capability, too.


If the full heap dump is too big, please try to get us the heap histogram (jmap -histo:live pid).

In the past, the distributed build support has often been a source of leakage (as this involves in a distributed garbage collection.) To check for this possibility, visit links like http://yourserver/jenkins/computer/YOURSLAVENAME/dumpExportTable. If this show too many objects, they may be leaks.


Report the summary of those findings to the list and we'll take it from there.

Using VisualVM

Unless you already have a preferred memory profiling tool, VisualVM is recommended for analyzing heap dumps. It is a standalone version of the NetBeans profiler, distributed with the Oracle JDK.

Run jvisualvm and use File » Load and select the heap dump. In the Classes tab, look for a class with a suspiciously large number of instances, if not already identified by jmap -histo. For example, to debug a Groovy script leak, type GroovyClassLoader in the filter field and double-click the line with no $ in it (just groovy.lang.GroovyClassLoader).

In the Instances tab you should now see all instances. Click on some at random. (If there are more than 500, they will be broken into groups of 500, with the first expanded; so to get a representative instance “from the middle”, collapse the first group, expand a group in the middle, and select some instance from that group.)

Under References, right-click this and select Show Nearest GC Root. Right-click the selected item in the tree and select Copy Path From Root. Paste this text, for several examples, into a text file and attach it to a bug report—or continue your investigation into plugin source code.