Class HeapTracer
java.lang.Object
com.ibm.wala.util.heapTrace.HeapTracer
Simple utility that uses reflection to trace memory
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionHeapTracer(Collection<? extends Object> c, boolean traceStatics) Creates a heap tracer with the given root instances. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidanalyzeLeaks(boolean traceStatics) Trace the heap and dump the output to the tracefilestatic voidperform()Trace the heap and return the resultsstatic @Nullable HeapTracer.ResulttraceHeap(Collection<? extends Object> instances, boolean traceStatics) Traces the heap and prints the results to standard error.
-
Constructor Details
-
HeapTracer
Creates a heap tracer with the given root instances.- Parameters:
c- collection of non-null root instancestraceStatics- whether to also trace static fields
-
-
Method Details
-
main
-
perform
public HeapTracer.Result perform() throws ClassNotFoundException, IllegalArgumentException, IllegalAccessExceptionTrace the heap and return the results -
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 @Nullable HeapTracer.Result traceHeap(Collection<? extends Object> instances, boolean traceStatics) Traces the heap and prints the results to standard error.- Parameters:
instances- collection of non-null root instancestraceStatics- whether to also trace static fields- Returns:
- the trace result, or
nullif tracing fails with anIllegalArgumentException,IllegalAccessException, orClassNotFoundException
-