Skip to content
🤔 Documentation issue? Report it

//leakcanary-repo/shark/MatchingGcRootProvider

MatchingGcRootProvider

[jvm]\ class MatchingGcRootProvider(referenceMatchers: List<ReferenceMatcher>) : GcRootProvider

TODO Extracted from PathFinder, this should eventually be part of public API surface and we should likely also revisit the gc root type filtering which happens during heap parsing, as that’s not really a concern for the heap parser and more for path finding. There are probably memory concerns as well there though. We could:

  • compress the storing of these roots
  • keep only the roots locations and read / deserialize as needed
  • Ensure a unique / consistent view of roots by doing the work of GcRootProvider at parsing time and keeping that list.

A GcRootProvider that matches roots against referenceMatchers.

Constructors

MatchingGcRootProvider [jvm]
constructor(referenceMatchers: List<ReferenceMatcher>)

Functions

Name Summary
provideGcRoots [jvm]
open override fun provideGcRoots(graph: HeapGraph): Sequence<GcRootReference>
Provides a sequence of GC Roots to traverse the graph from, ideally in a stable order.