LeakTrace

data class LeakTrace(    val gcRootType: LeakTrace.GcRootType,     val referencePath: List<LeakTraceReference>,     val 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.

Constructors

Link copied to clipboard
fun LeakTrace(    gcRootType: LeakTrace.GcRootType,     referencePath: List<LeakTraceReference>,     leakingObject: LeakTraceObject)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
enum GcRootType : Enum<LeakTrace.GcRootType>

Functions

Link copied to clipboard
fun referencePathElementIsSuspect(index: Int): Boolean

Returns true if the referencePath element at the provided index contains a reference that is suspected to cause the leak, ie if index is greater than or equal to the index of the LeakTraceReference of the last non leaking object and strictly lower than the index of the LeakTraceReference of the first leaking object.

Link copied to clipboard
fun toSimplePathString(): String
Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
val gcRootType: LeakTrace.GcRootType

The Garbage Collection root that references the LeakTraceReference.originObject in the first LeakTraceReference of referencePath.

Link copied to clipboard
val leakingObject: LeakTraceObject
Link copied to clipboard
val referencePath: List<LeakTraceReference>
Link copied to clipboard
val retainedHeapByteSize: Int?

The minimum number of bytes which would be freed if the leak was fixed. Null if the retained heap size was not computed.

Link copied to clipboard
val retainedObjectCount: Int?

The minimum number of objects which would be unreachable if the leak was fixed. Null if the retained heap size was not computed.

Link copied to clipboard
val signature: String

A SHA1 hash that represents this leak trace. This can be useful to group together similar leak traces.

Link copied to clipboard
val suspectReferenceSubpath: Sequence<LeakTraceReference>

A part of referencePath that contains the references suspected to cause the leak. Starts at the last non leaking object and ends before the first leaking object.