FaqMemoryDump

How to create a memory snapshot (if I want to report an OutOfMemoryError or a memory leak)?

See also how to create a good bug report, especially don't forget to add the IDE log file. Writing a detailed description of how the problem can be reproduced is the best way to make it easy to analyze and also to verify the fix later.

Heap Dump

A heap dump is the best source of information in most of cases of memory leaks - typically when you get OutOfMemoryError:Java heap space. Heap dump files are typically very large, so they should not be attached to bugzilla - see below for upload instructions.

There are several ways a heap dump can be created, e.g.:

  • Java VisualVM (which is part of JDK ($jdkdirectory/bin/visualvm)) can generate a heap dump. It can be easily generated by selecting "Take Heap Dump" from popup menu on the node representing your java application (in the left panel).
  • The IDE may be already set to generate the heap dump automatically whet it runs out of memory. Open the messages.log file (or from menu View | IDE Log) and search for string -XX:HeapDumpPath. If it is there, it will tell you where the heap dump is saved.
  • If the above is not true, you can add the
    -J-XX:+HeapDumpOnOutOfMemoryError
    flag into the etc/netbeans.conf file (in NetBeans install directory).
  • Another way is to use jmap tool from JDK (<pid> is the process ID of the IDE that run out of memory):
    jmap -dump:live,format=b,file=heap.bin <pid>

Uploading the heap dump file

Heap dump files are invariably very large, while they compress quite well using zip or gzip, it is not practical to attach them as an attachment to bugzilla. Rather, please use the following Hudson job, intended specifically for uploading large files: http://deadlock.netbeans.org/hudson/job/upload/build

  1. Compress the heap dump file using zip or gzip
  2. Select a file using the Choose File button at http://deadlock.netbeans.org/hudson/job/upload/build
  3. Press Build and wait until the upload completed (this will take a long time)
  4. The job will display a link to the uploaded file - paste this link to the bug report

Histogram

A memory histogram provides much less data than a heap dump (only numbers of instances and sizes), but is much easy to handle, can be sent via mail or attached to an issue. Usually it is enough to identify the culprit of the memory problem, though not exact cause of why so much memory is occupied.

The jmap tool from JDK 6 can be used for creating a histogram (<pid> is the process ID of the IDE):
jmap -histo:live <pid>

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo