Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Memory Analyzer (MAT) » Group by java.lang.ref.Finalizer.referent class name
Group by java.lang.ref.Finalizer.referent class name [message #2565] Wed, 13 August 2008 07:48 Go to next message
Mark Mandel is currently offline Mark Mandel
Messages: 1
Registered: July 2009
Junior Member
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 18:22 Go to previous message
Andreas Buchen is currently offline Andreas Buchen
Messages: 113
Registered: July 2009
Senior Member
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.
Previous Topic:Unsupported segment type 254 at position 366,014,124
Next Topic:Error running reports on Linux
Goto Forum:
  


Current Time: Thu Sep 18 01:45:04 GMT 2014

Powered by FUDForum. Page generated in 0.02911 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software