Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » how to get gc root of object using oql ? (MAT OQL GC ROOT )
how to get gc root of object using oql ? [message #1853245] Fri, 24 June 2022 06:56 Go to next message
jack jackie is currently offline jack jackieFriend
Messages: 1
Registered: June 2022
Junior Member
I need to get gc root of object using mat oql, but I don't find any built-in functions or other ways to do it.

I can get gc root of object by getting all gc roots(${snapshot}.@GCRoots)
and their RETAINED Set( select AS RETAINED SET) to see if the object is in the set, but this way is too slow。I need a more efficient way.

thanks a lot for any help!

Re: how to get gc root of object using oql ? [message #1853418 is a reply to message #1853245] Fri, 01 July 2022 06:08 Go to previous message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 205
Registered: July 2009
Senior Member
I don't know of a way of doing that.
You way does work, slowly, if there is just one GC root which retains the object, but not if it is retained by two or more. I think you were doing something like:

SELECT objects s FROM OBJECTS ${snapshot}.@GCRoots s WHERE (441668 IN (SELECT AS RETAINED SET OBJECTS t FROM OBJECTS ( s ) t ))

where 441668 is the object ID of your object.

This will find the root of the dominator tree for the object.
SELECT objects s FROM OBJECTS (dominators(-1)) s WHERE (441668 IN (SELECT AS RETAINED SET OBJECTS t FROM OBJECTS ( s ) t ))


The dominatorof() function returns the object which dominates this one - but I can't think of a way of calling it multiple times to get the root of the tree. (If the object is a root then the function returns -1.)
Previous Topic:How to include retained size column (with precise or approximate values) in histogram command result
Next Topic:Issues using IBM Seamer DTFJ
Goto Forum:
  


Current Time: Sat Jan 25 10:25:49 GMT 2025

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

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

Back to the top