When we are trying to analyze a huge hprof dump file, we sometimes experience the following error:
java.lang.OutOfMemoryError: Requested length of new long[2,147,483,640] exceeds limit of 2,147,483,639
This seems to be a known java/MAT limitation:
"Memory Analyzer has an architectural limit of 2^31 - 3 objects, a current limit of 2^31 - 8 = 2,147,483,640 objects, but has not been tested with that many objects."
There is a workaround to analyze so large heap dumps, by discarding a percentage of some kind of objects e.g. "String":
Window > Preferences > Memory Analyzer > HPROF Parser
Discard percentage: 80
Discard object type pattern: char\[\]|java\.lang\.String
That should discard 80% of the Strings and char arrays, perhaps bringing the total number of objects to less than 2,147,483,640.
You will also need to download the latest MAT version.