Objects with “no references” in hprof

大城市里の小女人 提交于 2019-12-01 19:57:38

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/7304665/objects-with-no-references-in-hprof

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!