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 class
ReferenceTreeObject.ReferenceTreeObjectType
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ReferenceTreeObject>
children
private int
distanceFromRoot
static int
FORMAT_ARRAY_INFO
static int
FORMAT_FIELD
static int
FORMAT_OTHER_MODIFIERS
static int
FORMAT_PACKAGE
static int
FORMAT_STATIC_MODIFIER
private java.util.Set<IItem>
items
private double
leakRelevance
private IMCOldObject
object
private int
objectsKeptAliveCount
private java.util.Map<IQuantity,ReferenceTreeObject>
oldObjectSamples
private ReferenceTreeObject
parent
private java.lang.String
rootDescription
private IQuantity
timestamp
-
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) void
addChild(ReferenceTreeObject node)
(package private) void
addItem(IItem item)
(package private) void
addRoot(IMCOldObjectGcRoot root)
boolean
equals(java.lang.Object o)
IQuantity
getAddress()
The address of the object, used for identity purposes.IMCOldObjectArray
getArray()
java.util.List<ReferenceTreeObject>
getChildren()
java.lang.String
getDescription()
Returns a description of the object.int
getDistanceFromRoot()
IMCOldObjectField
getField()
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
.double
getLeakRelevance()
int
getObjectsKeptAliveCount()
java.util.Map<IQuantity,ReferenceTreeObject>
getOldObjectSamples()
ReferenceTreeObject
getParent()
This method returns an object that is keeping this object alive.IMCOldObject
getReferrer()
Returns the object that refers to this object in the heap reference chain.IMCOldObjectArray
getReferrerArray()
If the object is referred to by an object in an array it returns the information about that array, otherwise it returnsnull
.IMCOldObjectField
getReferrerField()
If the object is referred to by an object in a field it returns a representation of the field,null
otherwise.int
getReferrerSkip()
Returns the number of steps away in the reference chain this object is from the next object referring to it.java.lang.String
getRootDescription()
ReferenceTreeObject
getRootObject()
IQuantity
getTimestamp()
IMCType
getType()
The type of the object, as anIMCType
int
hashCode()
(package private) void
incrementObjectsKeptAliveCount()
Increments the number of objects this object keeps alive.(package private) void
setDistanceFromRoot(int distance)
(package private) void
setLeakRelevance(double relevance)
void
setParent(ReferenceTreeObject parent)
java.lang.String
toString(int displayFormatting)
Returns a string representation of this object.void
updateOldObjectSamples(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
IItem
objects 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:IMCOldObject
The address of the object, used for identity purposes.- Specified by:
getAddress
in interfaceIMCOldObject
- Returns:
- the address of the object
-
getReferrerArray
public IMCOldObjectArray getReferrerArray()
Description copied from interface:IMCOldObject
If the object is referred to by an object in an array it returns the information about that array, otherwise it returnsnull
.- Specified by:
getReferrerArray
in 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,
null
otherwise
-
getChildren
public java.util.List<ReferenceTreeObject> getChildren()
- Returns:
- the children of this object
-
getReferrerField
public IMCOldObjectField getReferrerField()
Description copied from interface:IMCOldObject
If the object is referred to by an object in a field it returns a representation of the field,null
otherwise.- Specified by:
getReferrerField
in 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,
null
otherwise
-
getDescription
public java.lang.String getDescription()
Description copied from interface:IMCOldObject
Returns a description of the object.- Specified by:
getDescription
in 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:IMCOldObject
Returns the object that refers to this object in the heap reference chain.- Specified by:
getReferrer
in 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:IMCOldObject
The type of the object, as anIMCType
- Specified by:
getType
in interfaceIMCOldObject
- Returns:
- the type of the object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in 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:IMCOldObject
Returns 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:
getReferrerSkip
in 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
-
-