aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 18110
    
    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: 9313
    
109

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: 2051
    
  22

Well, MAT is open source. I am pretty sure you can find all the code you need to parse heap dumps in there.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading JVM heap bin file through java program
 
Similar Threads
Zip code tables
Pls help me out!
help in starting a program..
JCVS Client
Basic: How IO reads or write ByteStream and CharacterStream