//shark/shark

Package shark

Types

NameSummary
ApplicationLeak[jvm]
data class ApplicationLeak(leakTraces: List<LeakTrace>) : Leak
A leak found by HeapAnalyzer in your application.
AppSingletonInspector[jvm]
class AppSingletonInspector(singletonClasses: String) : ObjectInspector
Inspector that automatically marks instances of the provided class names as not leaking because they're app wide singletons.
FilteringLeakingObjectFinder[jvm]
class FilteringLeakingObjectFinder(filters: List<FilteringLeakingObjectFinder.LeakingObjectFilter>) : LeakingObjectFinder
Finds the objects that are leaking by scanning all objects in the heap dump and delegating the decision to a list of FilteringLeakingObjectFinder.LeakingObjectFilter
HeapAnalysis[jvm]
sealed class HeapAnalysis : Serializable
The result of an analysis performed by HeapAnalyzer, either a HeapAnalysisSuccess or a HeapAnalysisFailure. This class is serializable however there are no guarantees of forward compatibility.
HeapAnalysisException[jvm]
class HeapAnalysisException(cause: Throwable) : RuntimeException
HeapAnalysisFailure[jvm]
data class HeapAnalysisFailure(heapDumpFile: File, createdAtTimeMillis: Long, dumpDurationMillis: Long, analysisDurationMillis: Long, exception: HeapAnalysisException) : HeapAnalysis
The analysis performed by HeapAnalyzer did not complete successfully.
HeapAnalysisSuccess[jvm]
data class HeapAnalysisSuccess(heapDumpFile: File, createdAtTimeMillis: Long, dumpDurationMillis: Long, analysisDurationMillis: Long, metadata: Map<String, String>, applicationLeaks: List<ApplicationLeak>, libraryLeaks: List<LibraryLeak>, unreachableObjects: List<LeakTraceObject>) : HeapAnalysis
The result of a successful heap analysis performed by HeapAnalyzer.
HeapAnalyzer[jvm]
class HeapAnalyzer(listener: OnAnalysisProgressListener)
Analyzes heap dumps to look for leaks.
IgnoredReferenceMatcher[jvm]
class IgnoredReferenceMatcher(pattern: ReferencePattern) : ReferenceMatcher
IgnoredReferenceMatcher should be used to match references that cannot ever create leaks. The shortest path finder will never go through matching references.
KeyedWeakReferenceFinder[jvm]
object KeyedWeakReferenceFinder : LeakingObjectFinder
Finds all objects tracked by a KeyedWeakReference, ie all objects that were passed to ObjectWatcher.watch.
Leak[jvm]
sealed class Leak : Serializable
A leak found by HeapAnalyzer, either an ApplicationLeak or a LibraryLeak.
LeakingObjectFinder[jvm]
fun interface LeakingObjectFinder
Finds the objects that are leaking, for which Shark will compute leak traces.
LeakTrace[jvm]
data class LeakTrace(gcRootType: LeakTrace.GcRootType, referencePath: List<LeakTraceReference>, leakingObject: LeakTraceObject) : Serializable
The best strong reference path from a GC root to the leaking object. “Best” here means the shortest prioritized path. A large number of distinct paths can generally be found leading to a leaking object. Shark prioritizes paths that don‘t go through known LibraryLeakReferenceMatcher (because those are known to create leaks so it’s more interesting to find other paths causing leaks), then it prioritize paths that don't go through java local gc roots (because those are harder to reason about). Taking those priorities into account, finding the shortest path means there are less LeakTraceReference that can be suspected to cause the leak.
LeakTraceObject[jvm]
data class LeakTraceObject(type: LeakTraceObject.ObjectType, className: String, labels: Set<String>, leakingStatus: LeakTraceObject.LeakingStatus, leakingStatusReason: String, retainedHeapByteSize: Int?, retainedObjectCount: Int?) : Serializable
LeakTraceReference[jvm]
data class LeakTraceReference(originObject: LeakTraceObject, referenceType: LeakTraceReference.ReferenceType, owningClassName: String, referenceName: String) : Serializable
A LeakTraceReference represents an origin LeakTraceObject and either a reference from that object to the LeakTraceObject in the next LeakTraceReference in LeakTrace.referencePath, or to LeakTrace.leakingObject if this is the last LeakTraceReference in LeakTrace.referencePath.
LibraryLeak[jvm]
data class LibraryLeak(leakTraces: List<LeakTrace>, pattern: ReferencePattern, description: String) : Leak
A leak found by HeapAnalyzer, where the only path to the leaking object required going through a reference matched by pattern, as provided to a LibraryLeakReferenceMatcher instance. This is a known leak in library code that is beyond your control.
LibraryLeakReferenceMatcher[jvm]
data class LibraryLeakReferenceMatcher(pattern: ReferencePattern, description: String, patternApplies: (HeapGraph) -> Boolean) : ReferenceMatcher
LibraryLeakReferenceMatcher should be used to match references in library code that are known to create leaks and are beyond your control. The shortest path finder will only go through matching references after it has exhausted references that don't match, prioritizing finding an application leak over a known library leak. Library leaks will be reported as LibraryLeak instead of ApplicationLeak.
MetadataExtractor[jvm]
fun interface MetadataExtractor
Extracts metadata from a hprof to be reported in HeapAnalysisSuccess.metadata.
ObjectInspector[jvm]
fun interface ObjectInspector
Provides LeakCanary with insights about objects (classes, instances and arrays) found in the heap. inspect will be called for each object that LeakCanary wants to know more about. The implementation can then use the provided ObjectReporter to provide insights for that object.
ObjectInspectors[jvm]
enum ObjectInspectors : Enum<ObjectInspectors> , ObjectInspector
A set of default ObjectInspectors that knows about common JDK objects.
ObjectReporter[jvm]
class ObjectReporter(heapObject: HeapObject)
Enables ObjectInspector implementations to provide insights on heapObject, which is an object (class, instance or array) found in the heap.
OnAnalysisProgressListener[jvm]
fun interface OnAnalysisProgressListener
Reports progress from the HeapAnalyzer as they occur, as Step values.
ReferenceMatcher[jvm]
sealed class ReferenceMatcher
Used to pattern match known patterns of references in the heap, either to ignore them (IgnoredReferenceMatcher) or to mark them as library leaks (LibraryLeakReferenceMatcher).
ReferencePattern[jvm]
sealed class ReferencePattern : Serializable
A pattern that will match references for a given ReferenceMatcher.