本文介绍了具有“无参考"的对象被称为“无参考".在hprof中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究VisualVM中的hprof文件

服务器正在运行JDK 1.4.2_30,并具有1 GB的堆,NewSize为200 Mb.

hprof显示56000个int[]实例占用了71%的堆,而在VisualVM中查看时,这些56K数组都没有引用

根据我们的说法,如果没有引用",则应该将其收集为垃圾.所以问题是:

a)有什么方法可以找到这些参考文献?

b)这是不正确的快照-即采取堆转储的操作是否进行了某种GC的操作?

c)我们应该在VisualVM中查看保留大小"对象吗?

作为更新-我们仍然不知道这些int[]是什么,但是下一个最大的对象是Pool中的Weblogic内部EJB引用,我们发现其中之一具有不正确的设置将内存使用率从早期的频繁Full GC降低到30%

解决方案

免责声明:未来的猜测,我没有一个明确的答案,但我可能会给出一些有用的提示. /p>

我最近也遇到过类似的情况(尽管使用了最新的Java版本).

大量未引用的int[] 似乎被映射为某种类型的缓冲区的原因(我不是NIO专家,但似乎与此有关).

得出此结论的原因是,存在一个非常相似的数量的byte[],它们的内存大小几乎相同,并且这些byte[]被某些*Channel实例引用.

所以我的猜测是,那些int[]实际上是 synthetic 实例,实际上与byte[]共享了它们的内存(正确引用了 ).简而言之:它们是红色鲱鱼.

所有这些都是很多猜测,而我从来没有跟进,因为当时的实际问题完全无关紧要.

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

解决方案

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.

这篇关于具有“无参考"的对象被称为“无参考".在hprof中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 06:42