| 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: 16483
|
|
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: 8142
|
|
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: 1271
|
|
|
Well, MAT is open source. I am pretty sure you can find all the code you need to parse heap dumps in there.
|
 |
 |
|
|
subject: Reading JVM heap bin file through java program
|
|
|