Hprof文件解析

https://java.net/downloads/heap-snapshot/hprof-binary-format.html
https://github.com/badoo/hprof-tools
第一個連接爲hprof文件的字段說明,第二個文件爲github上面的一個解析hprof的開源項目
須要注意的幾個重點:
INSTANCE DUMP標籤中的字段[value]*的解析須要結合標籤CLASS DUMP中最後一個u2(Number of instance fields (not including super class's))字段來解析;
該value中的值也還包括super_class中的instance field的字段。
全部Basic Type中type值爲2的對應的value是該object的id,該id多是instance、objArr、PrimitiveArr的id。
class dump中的static和constant的field不包含在instance field中。
dump_tag中包含root字段的就是gcroot,查找某個實例是否泄漏的就是查找該實例到root的路徑html

相關文章
相關標籤/搜索