Skip to content

Heap Dumps larger than 2GB fail with "Unexpected top-level record type" exception #10

@gerossie

Description

@gerossie

First of all, thanks for providing this great tool. It provides a great base for custom HPROF parsing. I have run into one small issue though. In HprofParser.parseRecord(), if the HPROF is larger than 2GB (from a 64 bit JVM for example), calling

int bytesLeft = in.readInt();

to get the size of the heap dump (tag is 0xc) results in a negative number. This throws off the rest of the parsing and causes an "Unexpected top-level record type" exception (for me at least). I modified the code and changed the above to

long bytesLeft = in.readInt() & 0xFFFFFFFFL;

And modified a few other spots in the code. It's now working for me with heap dumps larger than 2GB.

Again, thanks for the great tool. If you could incorporate this change, along with any other changes you think would be required to support 64 bit HPROF files, I think it would greatly improve the usability of this tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions