Class ReferenceTreeObject
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.memleak.ReferenceTreeObject
-
- All Implemented Interfaces:
IMCOldObject
public class ReferenceTreeObject extends java.lang.Object implements IMCOldObject
A data type representing alive objects in a Java heap used in aReferenceTreeModel.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReferenceTreeObject.ReferenceTreeObjectType
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ReferenceTreeObject>childrenprivate intdistanceFromRootstatic intFORMAT_ARRAY_INFOstatic intFORMAT_FIELDstatic intFORMAT_OTHER_MODIFIERSstatic intFORMAT_PACKAGEstatic intFORMAT_STATIC_MODIFIERprivate java.util.Set<IItem>itemsprivate doubleleakRelevanceprivate IMCOldObjectobjectprivate intobjectsKeptAliveCountprivate java.util.Map<IQuantity,ReferenceTreeObject>oldObjectSamplesprivate ReferenceTreeObjectparentprivate java.lang.StringrootDescriptionprivate IQuantitytimestamp
-
Constructor Summary
Constructors Constructor Description ReferenceTreeObject(IQuantity timestamp, IMCOldObject object)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddChild(ReferenceTreeObject node)(package private) voidaddItem(IItem item)(package private) voidaddRoot(IMCOldObjectGcRoot root)booleanequals(java.lang.Object o)IQuantitygetAddress()The address of the object, used for identity purposes.IMCOldObjectArraygetArray()java.util.List<ReferenceTreeObject>getChildren()java.lang.StringgetDescription()Returns a description of the object.intgetDistanceFromRoot()IMCOldObjectFieldgetField()java.util.Set<IItem>getItems()This method is used when it is necessary to get information about all objects this object keeps alive in theReferenceTreeModel.doublegetLeakRelevance()intgetObjectsKeptAliveCount()java.util.Map<IQuantity,ReferenceTreeObject>getOldObjectSamples()ReferenceTreeObjectgetParent()This method returns an object that is keeping this object alive.IMCOldObjectgetReferrer()Returns the object that refers to this object in the heap reference chain.IMCOldObjectArraygetReferrerArray()If the object is referred to by an object in an array it returns the information about that array, otherwise it returnsnull.IMCOldObjectFieldgetReferrerField()If the object is referred to by an object in a field it returns a representation of the field,nullotherwise.intgetReferrerSkip()Returns the number of steps away in the reference chain this object is from the next object referring to it.java.lang.StringgetRootDescription()ReferenceTreeObjectgetRootObject()IQuantitygetTimestamp()IMCTypegetType()The type of the object, as anIMCTypeinthashCode()(package private) voidincrementObjectsKeptAliveCount()Increments the number of objects this object keeps alive.(package private) voidsetDistanceFromRoot(int distance)(package private) voidsetLeakRelevance(double relevance)voidsetParent(ReferenceTreeObject parent)java.lang.StringtoString(int displayFormatting)Returns a string representation of this object.voidupdateOldObjectSamples(ReferenceTreeObject oldobjectrefnode)This method updates the Root object's Map with allocationTime and its oldObjectReference object (leaves).
-
-
-
Field Detail
-
children
private final java.util.List<ReferenceTreeObject> children
-
items
private final java.util.Set<IItem> items
-
oldObjectSamples
private final java.util.Map<IQuantity,ReferenceTreeObject> oldObjectSamples
-
rootDescription
private java.lang.String rootDescription
-
object
private IMCOldObject object
-
objectsKeptAliveCount
private int objectsKeptAliveCount
-
parent
private ReferenceTreeObject parent
-
timestamp
private IQuantity timestamp
-
leakRelevance
private double leakRelevance
-
distanceFromRoot
private int distanceFromRoot
-
FORMAT_PACKAGE
public static final int FORMAT_PACKAGE
- See Also:
- Constant Field Values
-
FORMAT_FIELD
public static final int FORMAT_FIELD
- See Also:
- Constant Field Values
-
FORMAT_STATIC_MODIFIER
public static final int FORMAT_STATIC_MODIFIER
- See Also:
- Constant Field Values
-
FORMAT_OTHER_MODIFIERS
public static final int FORMAT_OTHER_MODIFIERS
- See Also:
- Constant Field Values
-
FORMAT_ARRAY_INFO
public static final int FORMAT_ARRAY_INFO
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReferenceTreeObject
ReferenceTreeObject(IQuantity timestamp, IMCOldObject object)
- Parameters:
timestamp- a timestamp representing when the object was allocatedobject- the object itself
-
-
Method Detail
-
setDistanceFromRoot
void setDistanceFromRoot(int distance)
- Parameters:
distance- the distance from the root object
-
getDistanceFromRoot
public int getDistanceFromRoot()
- Returns:
- the number of steps in a referral chain from the root object
-
setLeakRelevance
void setLeakRelevance(double relevance)
- Parameters:
relevance- how relevant this object is as a leak candidate
-
getLeakRelevance
public double getLeakRelevance()
- Returns:
- the relevance of this object for memory leak detection
-
addChild
void addChild(ReferenceTreeObject node)
- Parameters:
node- a child to be added to this object
-
addItem
void addItem(IItem item)
- Parameters:
item- an item this object keeps alive
-
getItems
public java.util.Set<IItem> getItems()
This method is used when it is necessary to get information about all objects this object keeps alive in theReferenceTreeModel. E.g. the Mission Control GUI uses this when a user selects a row in the tree to show everything below it as well in the properties view.- Returns:
- a set representing all
IItemobjects this object keeps alive, including itself
-
addRoot
void addRoot(IMCOldObjectGcRoot root)
- Parameters:
root- a GC root description
-
getRootDescription
public java.lang.String getRootDescription()
- Returns:
- the GC root description
-
getAddress
public IQuantity getAddress()
Description copied from interface:IMCOldObjectThe address of the object, used for identity purposes.- Specified by:
getAddressin interfaceIMCOldObject- Returns:
- the address of the object
-
getReferrerArray
public IMCOldObjectArray getReferrerArray()
Description copied from interface:IMCOldObjectIf the object is referred to by an object in an array it returns the information about that array, otherwise it returnsnull.- Specified by:
getReferrerArrayin interfaceIMCOldObject- Returns:
- a representation of the array data for the object referring to this old object
-
getArray
public IMCOldObjectArray getArray()
- Returns:
- if this object is an array, gets information representing that array,
nullotherwise
-
getChildren
public java.util.List<ReferenceTreeObject> getChildren()
- Returns:
- the children of this object
-
getReferrerField
public IMCOldObjectField getReferrerField()
Description copied from interface:IMCOldObjectIf the object is referred to by an object in a field it returns a representation of the field,nullotherwise.- Specified by:
getReferrerFieldin interfaceIMCOldObject- Returns:
- a representation of the field that refers to this object
-
getField
public IMCOldObjectField getField()
- Returns:
- if this object is a field, gets information representing that field,
nullotherwise
-
getDescription
public java.lang.String getDescription()
Description copied from interface:IMCOldObjectReturns a description of the object.- Specified by:
getDescriptionin interfaceIMCOldObject- Returns:
- the object description
-
getObjectsKeptAliveCount
public int getObjectsKeptAliveCount()
- Returns:
- the number of objects this object keeps alive
-
getParent
public ReferenceTreeObject getParent()
This method returns an object that is keeping this object alive.- Returns:
- the object linking to this object from the direction of the gc root
-
getReferrer
public IMCOldObject getReferrer()
Description copied from interface:IMCOldObjectReturns the object that refers to this object in the heap reference chain.- Specified by:
getReferrerin interfaceIMCOldObject- Returns:
- the object that refers to this object
-
getTimestamp
public IQuantity getTimestamp()
- Returns:
- the timestamp this object was allocated
-
getType
public IMCType getType()
Description copied from interface:IMCOldObjectThe type of the object, as anIMCType- Specified by:
getTypein interfaceIMCOldObject- Returns:
- the type of the object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
incrementObjectsKeptAliveCount
void incrementObjectsKeptAliveCount()
Increments the number of objects this object keeps alive.
-
setParent
public void setParent(ReferenceTreeObject parent)
- Parameters:
parent- the parent of this object
-
getRootObject
public ReferenceTreeObject getRootObject()
- Returns:
- the Root object
-
getReferrerSkip
public int getReferrerSkip()
Description copied from interface:IMCOldObjectReturns the number of steps away in the reference chain this object is from the next object referring to it. If this is greater than 0, it means that there are objects between this one and the referrer that were omitted when committing the traces to the Flight Recording file.- Specified by:
getReferrerSkipin interfaceIMCOldObject- Returns:
- the number of steps between this object and the next one towards the root in the reference chain
-
getOldObjectSamples
public java.util.Map<IQuantity,ReferenceTreeObject> getOldObjectSamples()
- Returns:
- Map containing allocation time and its oldObjectReference object
-
updateOldObjectSamples
public void updateOldObjectSamples(ReferenceTreeObject oldobjectrefnode)
This method updates the Root object's Map with allocationTime and its oldObjectReference object (leaves).- Parameters:
oldobjectrefnode- oldObjectReference leaf node
-
toString
public java.lang.String toString(int displayFormatting)
Returns a string representation of this object.- Parameters:
displayFormatting- an int describing how this object is to be represented, using bitwise masking of constants defined inReferenceTreeObject- Returns:
- a human readable string representation of this object
-
-