Class HeapTracer


  • public class HeapTracer
    extends java.lang.Object
    Simple utility that uses reflection to trace memory
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  HeapTracer.Result  
    • Constructor Summary

      Constructors 
      Constructor Description
      HeapTracer​(java.util.Collection<?> c, boolean traceStatics)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void analyzeLeaks()  
      static void analyzeLeaks​(boolean traceStatics)
      Trace the heap and dump the output to the tracefile
      static void main​(java.lang.String[] args)  
      HeapTracer.Result perform()
      Trace the heap and return the results
      static HeapTracer.Result traceHeap​(java.util.Collection<?> instances, boolean traceStatics)
      Trace the heap and dump the output to the tracefile
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HeapTracer

        public HeapTracer​(java.util.Collection<?> c,
                          boolean traceStatics)
        Parameters:
        c -
        traceStatics -
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
        Parameters:
        args -
      • perform

        public HeapTracer.Result perform()
                                  throws java.lang.ClassNotFoundException,
                                         java.lang.IllegalArgumentException,
                                         java.lang.IllegalAccessException
        Trace the heap and return the results
        Throws:
        java.lang.ClassNotFoundException
        java.lang.IllegalArgumentException
        java.lang.IllegalAccessException
      • analyzeLeaks

        public static void analyzeLeaks()
      • analyzeLeaks

        public static void analyzeLeaks​(boolean traceStatics)
        Trace the heap and dump the output to the tracefile
        Parameters:
        traceStatics - should all static fields be considered roots?
      • traceHeap

        public static HeapTracer.Result traceHeap​(java.util.Collection<?> instances,
                                                  boolean traceStatics)
        Trace the heap and dump the output to the tracefile
        Parameters:
        instances - instances to be considered roots of the heap traversal
        traceStatics - should all static fields be considered roots?