Java dump heap file location when using jconsole?

Okay, that’s awkward ...

I start playing with the Eclipse Memory Analyzer to look for Java memory leaks in a Windows window. Step 1 - get the heap dump file. To do this, I start my Java (javaw.exe) process from Eclipse and connect to it using jconsole. Then, on the MBeans jconsole tab, click dumpHeap. The first time I did this, I saw a pop-up message stating that he had created a heap dump file but did not give its name or location. Now, when I do dumpHeap again when connecting to another javaw.exe process, jconsole says:

Problem invoking dumpHeap : java.io.IOException: File exists 

and, of course, does not give his name or path. Where could it be?

I searched my C: drive (using cygwin command line tools) for files containing "hprof" or "java_pid" or "heapdump" and did not find anything believable. I even used Windows Search to search for all files in the Eclipse workspace that were changed on the last day.

I am using the Sun Java 1.6 JVM and do not have -XX: a set of HeapDumpPath.

Update (April 28, 2010):. My original heap file location should be determined by jconsole, from the tool from which I started the heap dump. The JVM heap dump location should only apply to heap dumps that it triggers (for example, in OutOfMemoryException).

Matt B's suggestion for using jvisualvm solves my problem perfectly, pointing me to a much more useful replacement for the old jconsole. It has a good memory profiler that shows which types of objects are the most numerous and store most of the memory. And it has a monitor that shows the actual memory usage over time. When you ask him about a heap dump, he even tells you the file name! The Eclipse memory analyzer gives you complete information.

+4
source share
5 answers

Try jvisualvm , it has a much better interface.

Please note that starting with the JDK version 6 7 or higher, Java VisualVM ships with the JDK. See here .

+8
source

why don't you set the first parameter for dumpHeap (String, boolean) when you try to call dumpHeap () from jconsole? this is the generated location and file name of the heapdump file.

+6
source

According to the docs for the Sun Java SE6 JVM:

By default, a heap dump is created in a file named java_pid <pid> .hprof in the VM working directory

In Eclipse, the working directory is defined on the Arguments tab of the Run Configuration dialog box. The default value is the same directory as the class you are using.

+4
source

You can always use ProcessMonitor to see where it is trying to write :) I did it myself in the past.

+2
source

I found the dumped file in the same folder as the .bat file that launches my Java application. (I use windows 8.1, java 7) In my case, jboss, / jboss-as / bin / folder. To find it, I looked for * files, with today's creation date and more than 200 MB.

0
source

Source: https://habr.com/ru/post/1308194/


All Articles