Heap Dump With Lots of 'Unresolved Name' Objects
To better understand why java.lang.OutOfMemoryError: Java heap space errors happen, it’s good to get a Java memory heap dump for further analysis.
Join the DZone community and get the full member experience.Join For Free
If you’re familiar with Java as a programming language, you may have come across the following message: java.lang.OutOfMemoryError: Java heap space. We recently got that message in one of the services that we’re currently working on. To better understand why this happens, it’s good to get a Java memory heap dump for further analysis.
Image describing a similar problem. Not actual heap dump of our project.
I had never seen that before, so I tried both memory analyzer applications to see if it had to do with the nightly build of MAT that I needed to use (because of Big Sur). MAT is usually my go-to tool for analyzing heap dumps, so I was quite surprised as I had not seen this before. Once I noticed both analyzers were showing this, I had to look elsewhere for the cause.
The first thing to do of course is to search the great internet, but there were only one or two results that showed something similar. One of the results was this Elasticsearch issue. I noticed I was not the only one that had the issue, but it did not show a solution and they were able to guess what the underlying issue was.
After pondering about it a bit more, I had the feeling it had to do something with the JDK and some incompatible export. The project uses Java 12.0.2 and I was also running Java 12.0.2 on my MacBook.
After some further analysis, it showed that the service used AdoptOpenJDK 12.0.2 and when double-checking SdkMan I noticed that I was also running Java 12.0.2, but I was running OpenJDK 12.0.2. After installing AdoptOpenJDK 12.0.2 and reparsing the heap dump the information was correct and I was able to see which classes and packages were actually taking up heap space.
So, long story short. If you encounter lots of ‘Unresolved Name’ entities check your JDK version on the machine you’re trying to analyze the heap dump.
If you want to use a different JVM for Eclipse on your Mac, you can make a change to
If you run into memory issues while trying to parse the heap dump, you can increase the MAT JVM heap size by changing
/Applications/mat.app/Contents/Eclipse/MemoryAnalyzer.ini and changing or adding the
Published at DZone with permission of Jeroen Reijn. See the original article here.
Opinions expressed by DZone contributors are their own.