I am running a program which creates an internal data structure for a very large tree. Each node in the tree contains HashMaps containing objects called RHS.
I am trying to debug memory usage using Java VisualVM. I have attached the photo below.
I understand the memory usage of String[], RHS, and Rule because each Rule contains one RHS which in turn contains a String[], hence why there are a similar number of instances of each. The one thing I don't understand is where I'm getting all these Object[] from. I think its also interesting that there are relatively few Object[] but they are each much larger than any of the objects being instantiated explicitly in my code
I never instantiate an Object[] anywhere in my code. Are these created as a byproduct of some other standard library data structure I'm using? (e.g. HashMap, HashSet, etc.)
When I try to heap dump it crashes my computer because the heap is too large. How can I investigate this memory issue more closely?
EDIT: I ran it on a smaller tree so that I could get a full heapdump, but I am a bit confused by the results.
I have screenshotted below a snapshot and a heap dump taken about 3 seconds apart. They show radically different information about the distribution of memory allocation by class. What does that mean?