public class ReferenceTreeModel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.List<ReferenceTreeObject> |
leakObjects |
private java.util.Map<IQuantity,ReferenceTreeObject> |
map |
private java.util.List<ReferenceTreeObject> |
rootObjects |
private java.util.Map<IItem,ReferenceTreeObject> |
rootObjectsByLeakItems |
Modifier | Constructor and Description |
---|---|
private |
ReferenceTreeModel() |
Modifier and Type | Method and Description |
---|---|
private void |
add(IItem item,
IMemberAccessor<IMCOldObject,IItem> objectAccessor,
IMemberAccessor<IQuantity,IItem> allocationTimeAccessor,
IMemberAccessor<IMCOldObjectGcRoot,IItem> gcRootAccessor,
IType<IItem> type)
Adds an
IItem to the tree model as a ReferenceTreeObject |
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.
|
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.
|
private ReferenceTreeObject |
getLeakCandidates(ReferenceTreeObject object,
ReferenceTreeObject root,
int distanceFromRoot,
ReferenceTreeObject leakCandidate)
A helper method to traverse the tree with a recursive depth-first search.
|
int |
getLeakCountInRange(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) |
ReferenceTreeObject |
getObject(IQuantity address) |
java.util.Map<IMCType,java.util.List<ReferenceTreeObject>> |
getObjectsByType() |
java.util.List<ReferenceTreeObject> |
getRootObjects() |
java.util.Collection<ReferenceTreeObject> |
getRootObjects(IRange<IQuantity> timerange) |
private ReferenceTreeObject |
setLeakRelevance(ReferenceTreeObject object,
ReferenceTreeObject root,
int distanceFromRoot,
ReferenceTreeObject leakCandidate)
Evaluates a ReferenceTreeObject as a candidate for a memory leak.
|
private final java.util.Map<IQuantity,ReferenceTreeObject> map
private final java.util.List<ReferenceTreeObject> rootObjects
private final java.util.List<ReferenceTreeObject> leakObjects
private final java.util.Map<IItem,ReferenceTreeObject> rootObjectsByLeakItems
public static ReferenceTreeModel buildReferenceTree(IItemCollection items)
items
- should be a filtered item collection containing only the Old Object Sample eventspublic java.util.List<ReferenceTreeObject> getRootObjects()
public java.util.List<ReferenceTreeObject> getLeakCandidates(double relevanceThreshold)
relevanceThreshold
- the threshold used to determine which objects to return as interesting memory leak
candidatesprivate ReferenceTreeObject getLeakCandidates(ReferenceTreeObject object, ReferenceTreeObject root, int distanceFromRoot, ReferenceTreeObject leakCandidate)
Every touched node gets a calculated distance to the root node to assist with calculating how likely that particular node is to be a leak candidate.
object
- the node to begin/continue the search fromroot
- the original root node, needed for candidate evaluationdistanceFromRoot
- the distance from the root node to the current object nodeleakCandidate
- the most promising leak candidate found so farprivate ReferenceTreeObject setLeakRelevance(ReferenceTreeObject object, ReferenceTreeObject root, int distanceFromRoot, ReferenceTreeObject leakCandidate)
The calculation of each objects relevance as a candidate is a factor of the following:
object
- the object to evaluate as a candidateroot
- the root objectdistanceFromRoot
- how many steps from the root the object isleakCandidate
- the prior best leak candidatepublic java.util.Map<IMCType,java.util.List<ReferenceTreeObject>> getObjectsByType()
public java.util.Collection<ReferenceTreeObject> getRootObjects(IRange<IQuantity> timerange)
timerange
- a range of time that specifies which root objects to retrievepublic java.util.Collection<ReferenceTreeObject> getLeakObjects(IRange<IQuantity> timerange)
timerange
- a range of time that specifies which root objects to retrievepublic int getLeakCountInRange(IRange<IQuantity> timerange, ReferenceTreeObject referenceTreeObject)
timerange
- a range of time that specifies which root objects to retrievereferenceTreeObject
- leak candidatepublic java.util.List<ReferenceTreeObject> getLeakObjects()
public ReferenceTreeObject getObject(IQuantity address)
address
- the address of a specific object to retrieve from the reference treeprivate void add(IItem item, IMemberAccessor<IMCOldObject,IItem> objectAccessor, IMemberAccessor<IQuantity,IItem> allocationTimeAccessor, IMemberAccessor<IMCOldObjectGcRoot,IItem> gcRootAccessor, IType<IItem> type)
IItem
to the tree model as a ReferenceTreeObject
item
- the item to addobjectAccessor
- an accessor for IMCOldObject
allocationTimeAccessor
- an accessor for the allocation timegcRootAccessor
- an accessor for IMCOldObjectGcRoot
type
- the type of the item