Skip to main content

why is java.lang.ref.ReferenceQueue showing up in profiler output?

1 reply [Last post]
tupari
Offline
Joined: 2005-06-15

java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Server VM (build 1.5.0_07-b03, mixed mode)

I ran my test program using:
java -Xrunhprof:file=/tmp/hprof.txt,cpu=times,depth=11

The top three stack traces ended up being:
TRACE 307249:
java.lang.Object.wait(Object.java:Unknown line)
java.lang.ref.Reference$ReferenceHandler.run(Reference.java:Unknown line)
TRACE 307268:
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:Unknown line)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:Unknown line)
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:Unknown line)
TRACE 325143:
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:Unknown line)
sun.rmi.transport.DGCClient$EndpointEntry$RenewCleanThread.run(DGCClient.java:Unknown line)
java.lang.Thread.run(Thread.java:Unknown line)

CPU TIME (ms) BEGIN (total = 43777021) Tue Dec 12 22:42:05 2006
rank self accum count trace method
1 24.74% 24.74% 93 307249 java.lang.Object.wait
2 24.47% 49.20% 271 307268 java.lang.ref.ReferenceQueue.remove
3 24.32% 73.53% 79 325143 java.lang.ref.ReferenceQueue.remove

So what are those ReferenceQueues, and how do I get rid of them?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
briand
Offline
Joined: 2005-07-11

> java version "1.5.0_07"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
> Java HotSpot(TM) Server VM (build 1.5.0_07-b03, mixed mode)
>
> I ran my test program using:
> java -Xrunhprof:file=/tmp/hprof.txt,cpu=times,depth=11
>
> The top three stack traces ended up being:
> TRACE 307249:
> java.lang.Object.wait(Object.java:Unknown:Unknown line)
> java.lang.ref.Reference$ReferenceHandler.run(Reference.java:Unknown line)

I think you can ignore this one. it's just blocking in wait(). I thought that this had been fixed; you may want to try a later update release.

> TRACE 307268:
> java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:Unknown line)
> java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:Unknown line)
> java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:Unknown line)

This is an indication that you have a lot of finalizer objects; classes that override the default finalize() method. You really want to minimize or eliminate as much finalization processing as possible.

> TRACE 325143:
> java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:Unknown line)
> sun.rmi.transport.DGCClient$EndpointEntry$RenewCleanThread.run(DGCClient.java:Unknown line)
> java.lang.Thread.run(Thread.java:Unknown:Unknown line)
>

This is indication of reference processing. However, this one seems to be tied to RMI Distributed GC processing. Do you have a lot of remote objects with short life spans?

A heap profile with xprof and heap=sites might help a bit. You might also try 'jmap -finalizerinfo' which is new in JDK 6.

HTH
Brian