Class ReferenceTreeModel
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.memleak.ReferenceTreeModel
-
public class ReferenceTreeModel extends java.lang.ObjectThe ReferenceTreeModel is used to build a representation of Old Object Sample JFR events which consists of one tree per GC root. Each object in the model is a ReferenceTreeObject instance, which is a subclass of IMCOldObject. The objects referred to as "Leak Objects" here are specifically those that were sampled by the JFR implementation and exist as the top-level Old Objects in the Old Object Sample event.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ReferenceTreeModelbuildReferenceTree(IItemCollection items)Creates and returns a ReferenceTreeModel object that represents the total reference tree created by Old Object Samples and their aggregated reference chains.java.util.List<ReferenceTreeObject>getLeakCandidates(double relevanceThreshold)Performs a leak relevance calculation on every object in the reference tree and sets this value to the respective objects.intgetLeakCountInRange(IRange<IQuantity> timerange, ReferenceTreeObject referenceTreeObject)A helper method to calculate number of Referenced Object within specified period.java.util.List<ReferenceTreeObject>getLeakObjects()java.util.Collection<ReferenceTreeObject>getLeakObjects(IRange<IQuantity> timerange)ReferenceTreeObjectgetObject(IQuantity address)java.util.Map<IMCType,java.util.List<ReferenceTreeObject>>getObjectsByType()java.util.List<ReferenceTreeObject>getRootObjects()java.util.Collection<ReferenceTreeObject>getRootObjects(IRange<IQuantity> timerange)
-
-
-
Method Detail
-
buildReferenceTree
public static ReferenceTreeModel buildReferenceTree(IItemCollection items)
Creates and returns a ReferenceTreeModel object that represents the total reference tree created by Old Object Samples and their aggregated reference chains.- Parameters:
items- should be a filtered item collection containing only the Old Object Sample events- Returns:
- a ReferenceTreeModel object to use when querying the reference tree
-
getRootObjects
public java.util.List<ReferenceTreeObject> getRootObjects()
- Returns:
- a list of all objects that are Roots in the reference tree
-
getLeakCandidates
public java.util.List<ReferenceTreeObject> getLeakCandidates(double relevanceThreshold)
Performs a leak relevance calculation on every object in the reference tree and sets this value to the respective objects.- Parameters:
relevanceThreshold- the threshold used to determine which objects to return as interesting memory leak candidates- Returns:
- a list of ReferenceTreeObject instances that have been deemed to be memory leak candidates
-
getObjectsByType
public java.util.Map<IMCType,java.util.List<ReferenceTreeObject>> getObjectsByType()
- Returns:
- a map between classes and the corresponding reference tree objects
-
getRootObjects
public java.util.Collection<ReferenceTreeObject> getRootObjects(IRange<IQuantity> timerange)
- Parameters:
timerange- a range of time that specifies which root objects to retrieve- Returns:
- a list of all objects that are Roots in the reference tree during the specified time range
-
getLeakObjects
public java.util.Collection<ReferenceTreeObject> getLeakObjects(IRange<IQuantity> timerange)
- Parameters:
timerange- a range of time that specifies which root objects to retrieve- Returns:
- a list of all Roots which has a leaked object during the specified time range
-
getLeakCountInRange
public int getLeakCountInRange(IRange<IQuantity> timerange, ReferenceTreeObject referenceTreeObject)
A helper method to calculate number of Referenced Object within specified period.- Parameters:
timerange- a range of time that specifies which root objects to retrievereferenceTreeObject- leak candidate- Returns:
- number of leaked object during the specified timerange for a given leak candidate
-
getLeakObjects
public java.util.List<ReferenceTreeObject> getLeakObjects()
- Returns:
- a list of the actual objects sampled by the Old Object Sample event
-
getObject
public ReferenceTreeObject getObject(IQuantity address)
- Parameters:
address- the address of a specific object to retrieve from the reference tree- Returns:
- the specified object
-
-