Group by java.lang.ref.Finalizer.referent class name [message #2565] |
Wed, 13 August 2008 03:48  |
Eclipse User |
|
|
|
Hey guys,
I'm trying to work out a memory leak on this application, and I'm seeing a
huge number of java.lang.ref.Finalizer objects on the heap.
Now that leads me to assume there are lots of little objects getting sent
to the GC, or something similar.
Each Finalizer has a referent property, which points to a java.lang.Object.
What I want to be able to do is get a report of a count of the number of
each type of class the referent has, within the Finalizer.
So if I was writing regular SQL, it would be something like:
SELECT COUNT(classof(f.referent)), classof(f.referent) class from
java.lang.ref.Finalizer f GROUP BY class
If that makes sense?
I can get a list of all the classes (~17k) that exist on the heap, via the
referent, like so:
Select classof(f.referent) from java.lang.ref.Finalizer f
But that won't give me the actual counts for groups of classes.
Any help would be appreciated greatly.
TIA.
|
|
|
Re: Group by java.lang.ref.Finalizer.referent class name [message #2599 is a reply to message #2565] |
Wed, 13 August 2008 14:22  |
Eclipse User |
|
|
|
Hi,
this query returns all objects which are held by the Finalizer object.
SELECT OBJECTS referent FROM INSTANCEOF java.lang.ref.Finalizer
The keyword OBJECTS tells the compiler to treat the result as an object
list (which makes it easier to work with this). The INSTANCEOF looks for
objects of this class and its sub-classes.
Once you have the list (this is true for any list of objects), press the
right most button in the tool bar "Show as Histogram". This groups the
objects by class or by class loader. And this is what you want.
Alternatively, you can choose "Java Basics" -> "References" -> "Finalizer
Reference Statistics" from the Query menu (the drop-down menu with the
blue circles in the toolbar). This opens 2 windows: the first table
contains the result of the query above.
The second table says which of those objects in the "referent" field would
be garbage collected if the reference via "referent" (and only this
reference) would be removed. Alas the retained set if the Finalizers were
gone (which is different, remember, because the same object could be
referenced from other corners of the object graph).
Cheers,
Andreas.
|
|
|
Powered by
FUDForum. Page generated in 0.03956 seconds