wood burning stoves 2.0*
The moose likes Performance and the fly likes Reading JVM heap bin file through java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Reading JVM heap bin file through java program" Watch "Reading JVM heap bin file through java program" New topic
Author

Reading JVM heap bin file through java program

Shounak Kundu
Ranch Hand

Joined: Jul 29, 2010
Posts: 60

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..


Shounak
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jul 29, 2010
Posts: 60

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

Joined: Jul 20, 2005
Posts: 10069
    
163

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.

[My Blog] [JavaRanch Journal]
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2346
    
  28

Well, MAT is open source. I am pretty sure you can find all the code you need to parse heap dumps in there.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Reading JVM heap bin file through java program