• Register
0 votes

Problem :

I had to run the jmap so that I can take the heap dump of my process. But the jvm returned below error :

Unable to open socket file: target process not responding or HotSpot VM not loaded

The -F option can be used when the target process is not responding

So I tried using the -F:

./jmap -F -dump:format=b,file=heap.bin 10330

Attaching to process ID 10331, please wait...

Debugger attached successfully.

Server compiler detected.

JVM version is 24.51-b03

Dumping heap to heap.bin ...

1.      Using -F is correct approach to take the heap dump?

2.      I am waiting for more than 20 minutes and not finished yet. Any ideas why it is taking so long?

6 5 3
7,540 points

1 Answer

0 votes

Solution :

jmap -F OR  jstack -F

While trying to run with -F the tools switch to the special mode that features the HotSpot Serviceability Agent. In current mode the target process is frozen; the tools often read its memory via the OS debugging facilities, namely, ptrace on the Linux.

1.      jmap -F invokes the PTRACE_ATTACH on your target JVM. Your target process is unconditionally suspended in response to the SIGSTOP signal.

2.      The tool reads the JVM memory using PTRACE_PEEKDATA. Here ptrace can read only one word at the time, so too many calls are required to read the large heap of your target process. This is too slow.

3.      The tool reconstructs your JVMs internal structures based on the knowledge of the particular JVMs version. As different versions of JVM have the different memory layout, your -F mode works only if the jmap comes from the same JDK as that of the target Java process.

4.      The tool will create heap dump itself and after that resumes the target process.

9 7 4
38,600 points

Related questions

0 votes
1 answer 90 views
Problem : I am having a box with 8gb of ram, so I don't think the total memory is the issue. This application is running properly on boxes with 6gb or less ram. What I am trying to do is to reserve 3GB of space using -Xmx3G command under "VM ... : Error occurred during initialization of VM; Could not reserve enough space for object heap using -Xmx3G Why am I getting such error any clue?
asked Nov 26, 2019 alecxe 7.5k points
1 vote
1 answer 92 views
Problem : I have recently started learning Android. If I try to execute my Android project on my Eclipse ADT then I often see below errors in my Console: [Dex Loader] Failed to load C:\Users\Martin\android-sdks\build-tools\26.0.0-preview\lib\dx.jar [ ... this case "C:\Users\Martin\android-sdks" is considered as the SDK folder. Kindly help me in fixing above strange looking Android error.
asked May 21 Martin K 6.6k points
1 vote
1 answer 1.3K views
Problem: I am a windows seven user and recently I’ve installed JDK to learn java but I am getting an error. The message is something like: Missing server JVM at `C:\Program Files\Java\jre7\bin\server\jvm­­.dll' please install or use the JRE or JDK that contains these missing components. Your kind solution is much appreciated.
asked Mar 22 Gavin 15.3k points
0 votes
1 answer 1.4K views
Problem : I am beginner to Java. I have one doubt about Java Compilers as below. “For compiling a java code we have separate compilers for different os.” Can someone answer my question?
asked Feb 29 mphil 2.3k points