Home » Android » android – Unexpected error while processing hprof file: null

android – Unexpected error while processing hprof file: null

Posted by: admin May 14, 2020 Leave a comment


I’m having a massive memory issue on specific devices where a ton of memory is allocated out of nowhere. I’m trying to do a heapdump to figure out what is allocating the memory, but when I attempt to open the heapdump file, I get an error in Android Studio:

HprofView - Unexpected error while processing hprof file: null

Error occurring

I’ve done some web searching, but there aren’t any references to this error as far as I can tell. I just need help getting the heap dump, I can fix my app from there.

Edit: I tried converting the dump file, but it gave me another error:

Convert Android Java Heap Dump - Unexpected error while converting heap dump: ERROR: read 16710959 of 33177623 bytes

error when trying to export to standard hprof

How to&Answers:

I can’t give a definitive answer, but in my experience it seems to happen when the app is close to its memory usage limit. This is obviously not ideal when you’re trying to debug an OutOfMemoryError!

2 things I can suggest to get around the problem:

  1. Try using a different device/emulator. e.g. I’ve found this issue is quite common on my Samsung S5, but happens less often on my Nexus 4.
  2. Pause the application some time before it runs out of memory, then get the heap dump at that point. This isn’t ideal, but memory leaks tend to cause a problem over time, rather all at once, so you should still be able to diagnose the leak.