This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading JVM heap bin file through java program  RSS feed

 
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
Posts: 22374
42
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
Sheriff
Posts: 10447
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: 2762
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!