How to save a bunch (dump to file) in Eclipse?

I get this error when I launch or debug my GA / AI from MyEclipse:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

eclipse.ini looks like this:

-showsplash com.genuitec.myeclipse.product --launcher.XXMaxPermSize 256m -vmargs -Xms128m -Xmx512m -Duser.language=en -XX:PermSize=128M -XX:MaxPermSize=256M 

MyEclipse is called like this:

 "C:\Program Files\MyEclipse 6.0\eclipse\eclipse.exe" -vm "C:\Program Files\MyEclipse 6.0\jre\bin\javaw.exe" -vmargs -Xms1448M -Xmx1448M 

bumping vm settings:

 "C:\Program Files\MyEclipse 6.0\eclipse\eclipse.exe" -vm "C:\Program Files\MyEclipse 6.0\jre\bin\javaw.exe" -vmargs -Xms80M -Xmx1024M 

has no effect. So I'm trying to get it to dump a bunch into a file, but putting them:

 -XX:+HeapDumpOnCtrlBreak -XX:+HeapDumpOnOutOfMemoryError 

in the arguments of the program is not affected. How do I get something to work with a great analysis of memory usage? jstack, for example, is currently not available on Windows platforms. And using SendSignal does not affect what I see.

a screen shot

+4
source share
3 answers

There are several ways to get heap dumps. Here are some of them that I used:

  • -XX:+HeapDumpOnOutOfMemoryError should reset you if you press your OOM.
  • Connect to VisualVM (free) and use your GUI to force a heap reset
  • Use one of many good commercial profilers (JProfiler, YourKit, ...)
  • Use jmap (see below) to make the dump work.

If you are using Java 6, jmap should work on Windows. This can be useful if you want to drop the heap and you are not in the OOM. Use the Windows task manager to find the pid of your Java application, and in the console, do the following:

 jmap -dump:format=b,file=c:\heap.bin <pid> 

In addition to VisualVM, Eclipse Memory Analyzer (also free) can help you analyze what to eat all the space when you have a dump.

+11
source

-XX:+HeapDumpOnOutOfMemoryError should be placed in " VM Arguments " not " Program Arguments "

+2
source

You can track memory usage using JConsole.

jstat will also help.

+1
source

All Articles