Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objects with "no references" in hprof

Tags:

jvm

visualvm

I'm investigating an hprof file in VisualVM

The server is running JDK 1.4.2_30 and has 1 GB heap with NewSize of 200 Mb.

The hprof shows 71% of the heap occupied by 56000 instances of int[] and none of these 56K arrays have references when viewed in VisualVM

As per us, this should have been garbage collected if there were "no references". So the questions are:

a) is there any way to find out these references?

b) Is this an incorrect snapshot - i.e. did the action of taking the heap dump do some sort of GC ?

c) Should we be looking at the "retained sizes" objects in VisualVM?

As an update - we still dont know what these int[] are, but the next largest objects were Weblogic internal EJB references in Pool, and we discovered an incorrect setting in one of those which has brought down memory util to 30% from earlier frequent Full GCs

like image 924
JoseK Avatar asked Sep 05 '11 06:09

JoseK


1 Answers

Disclaimer: guesswork ahead, I don't have a clear answer, but I might be able to give some useful hints.

I've seen a similar situation lately ('though with a much more current Java version).

The reason for the big number of unreferenced int[] seems to have been mapped buffers of some kind (I'm not a NIO expert, but it seems to have been related to this).

The reason for this conclusion is that there was a very similar number of byte[] around with pretty much the same size in memory and those byte[] were referenced by some *Channel instances.

So my guess is (was) that those int[] are actually synthetic instances that actually share their memory with the byte[] (which are properly referenced). In short: they are red herrings.

All of this is a lot of guesswork and I never followed up with it, because the actual problem at that time turned out to be something entirely unrelated.

like image 115
Joachim Sauer Avatar answered Sep 22 '22 19:09

Joachim Sauer