• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading JVM heap bin file through java program

 
Shounak Kundu
Ranch Hand
Posts: 60
IBM DB2 Eclipse IDE Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can successfully generate take heap snapshot and save it as a binary file.
Now , the problem is as I don't know the structure / format of binary heap file , I can not read it from program. I know , I can do it using jhat. But I want to do it through code.

Any pointers in this regard ?

Thanks in advance..
 
Paul Clapham
Sheriff
Pie
Posts: 20725
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might be obvious... but if you want to write code which reads and interprets that file, you need to know its format. So your next step is to find that out.

Also, presumably "jhat" is a program, so it's reading the file "through code". However if you don't want to use that code, then yes, you need to write your own.
 
Shounak Kundu
Ranch Hand
Posts: 60
IBM DB2 Eclipse IDE Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:This might be obvious... but if you want to write code which reads and interprets that file, you need to know its format. So your next step is to find that out.

Also, presumably "jhat" is a program, so it's reading the file "through code". However if you don't want to use that code, then yes, you need to write your own.


Yeah , I know that. I just wanted to know the format of binary file , as even after exhaustive googling I could not find anything in this regard.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't checked, but I guess each JVM vendor has its own format for that. And it probably won't be easy to find much documentation around this.
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, MAT is open source. I am pretty sure you can find all the code you need to parse heap dumps in there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic