Class ReferenceTreeModel


  • public class ReferenceTreeModel
    extends Object
    The 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 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 List<ReferenceTreeObject> getRootObjects()
        Returns:
        a list of all objects that are Roots in the reference tree
      • getLeakCandidates

        public 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
      • getRootObjects

        public 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 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 retrieve
        referenceTreeObject - leak candidate
        Returns:
        number of leaked object during the specified timerange for a given leak candidate
      • getLeakObjects

        public 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