Skip to content
🤔 Documentation issue? Report it

//leakcanary/leakcanary/HeapAnalysisConfig

HeapAnalysisConfig

data class HeapAnalysisConfig(val referenceMatchers: List<ReferenceMatcher> = AndroidReferenceMatchers.appDefaults, val objectInspectors: List<ObjectInspector> = AndroidObjectInspectors.appDefaults, val metadataExtractor: MetadataExtractor = AndroidMetadataExtractor, val computeRetainedHeapSize: Boolean = true, val leakingObjectFinder: LeakingObjectFinder = FilteringLeakingObjectFinder( AndroidObjectInspectors.appLeakingObjectFilters ), val stripHeapDump: Boolean = false, val proguardMappingProvider: () -> ProguardMapping? = { null })

Constructors

HeapAnalysisConfig fun HeapAnalysisConfig(referenceMatchers: List<ReferenceMatcher> = AndroidReferenceMatchers.appDefaults, objectInspectors: List<ObjectInspector> = AndroidObjectInspectors.appDefaults, metadataExtractor: MetadataExtractor = AndroidMetadataExtractor, computeRetainedHeapSize: Boolean = true, leakingObjectFinder: LeakingObjectFinder = FilteringLeakingObjectFinder( AndroidObjectInspectors.appLeakingObjectFilters ), stripHeapDump: Boolean = false, proguardMappingProvider: () -> ProguardMapping? = { null })

Properties

Name Summary
computeRetainedHeapSize val computeRetainedHeapSize: Boolean = true
Whether to compute the retained heap size, which is the total number of bytes in memory that would be reclaimed if the detected leaks didn’t happen. This includes native memory associated to Java objects (e.g. Android bitmaps).
leakingObjectFinder val leakingObjectFinder: LeakingObjectFinder
Finds the objects that are leaking, for which LeakCanary will compute leak traces.
metadataExtractor val metadataExtractor: MetadataExtractor
Extracts metadata from a hprof to be reported in shark.HeapAnalysisSuccess.metadata. Called on a background thread during heap analysis.
objectInspectors val objectInspectors: List<ObjectInspector>
List of ObjectInspector that provide LeakCanary with insights about objects found in the heap. You can create your own ObjectInspector implementations, and also add a shark.AppSingletonInspector instance created with the list of internal singletons.
proguardMappingProvider val proguardMappingProvider: () -> ProguardMapping?
referenceMatchers val referenceMatchers: List<ReferenceMatcher>
Known patterns of references in the heap, added here either to ignore them (IgnoredReferenceMatcher) or to mark them as library leaks (LibraryLeakReferenceMatcher).
stripHeapDump val stripHeapDump: Boolean = false
Whether the first step after a heap dump should be to replace the content of all arrays with zeroes. This increases the overall processing time but limits the amount of time the heap dump exists on disk with potential PII.