0

I have an taken a core dump file from a machine, with file size 2GB. I can open this file with gdb and see the processes that were running when I took the core file. I want though to convert this file into a heap dump in order to see more useful information. I tried running the below commands without any success. Does anyone have an idea why the file is not converted into heap dump? How can I perform this action?

I tried the bellow commands but I get errors and the file never is being created.

jmap -heap:format=b file=jvmcore.hprof /usr/lib/jvm/jdk1.5.0_22/ jvm.core Usage: jmap \[option\] \<pid\> (to connect to a live java process) or jmap \[option\] \<executable\> \<core\> (to connect to a core file) or jmap \[option\] \[server_id@\]\<remote server IP or hostname\> (to connect to a remote debug server) where option must be one of: \<no option\> to print same info as Solaris pmap \-heap to print java heap summary \-heap:format=b to dump java heap in hprof binary format \-histo to print histogram of java object heap \-permstat to print permanent generation statistics \-h | -help to print this help message

Same result as above i got with the following command:

jmap -heap:format=b file=jvmcore.hprof /usr/lib/jvm/jdk1.5.0_11/ jvm.core

And trying this command gets an error:

jmap -heap:format=b file=jvmcore.hprof jvm.core Attaching to core jvm.core from executable file=jvmcore.hprof, please wait... Error attaching to core file: Can't attach to the core file

Sankalpa Wijewickrama
  • 985
  • 3
  • 19
  • 30
  • 1
    JDK 1.5? You are kidding right? You should be upgrading to at least Java 8. Java 5 public support ended in 2009, and paid-for support in 2015. (And jdk1.5.0_11 is from 2007.) – Stephen C Mar 24 '22 at 15:01
  • I know, but i have not tested the application with a newer java version. So i am not sure if it will be alright. Is there a way to create the heap dump file? – gepapageorgiou Mar 24 '22 at 15:34
  • What I am thinking is that 1) creating a heap dump from a core file (of a Java 8 JVM) is more likely to work, and 2) why not just create one from the running JVM (Java 8). My advice would be to prioritize upgrading to Java 8 over ... whatever it is you are trying to investigate via the heap dump. – Stephen C Mar 24 '22 at 22:27
  • 1
    It doesn’t look like your application worked very well with JDK 1.5 either. So why do you worry about your application not being tested with a newer version? What’s the worst that could happen? That you end up having to extract a heap dump from a core dump? – Holger Mar 31 '22 at 16:03

0 Answers0