package Ġsh ark Ċ Ċ import Ġsh ark . Filtering Le aking Object Finder . Le aking Object Filter Ċ import Ġsh ark . H prof Heap Graph . Companion . open Heap Graph Ċ import Ġsh ark . Reference Pattern . Instance Field Pattern Ċ import Ġsh ark . Reference Pattern . Java Local Pattern Ċ import Ġjava . io . File Ċ import Ġjava . lang . ref . Ph antom Reference Ċ import Ġjava . lang . ref . Soft Reference Ċ import Ġjava . lang . ref . Weak Reference Ċ Ċ fun Ġ< T Ġ: ĠHeap Analysis > ĠDual Source Provider . check For Le aks ( ĊĠ Ġobject Inspect ors : ĠList < Object Inspector > Ġ= Ġempty List (), ĊĠ Ġcompute Ret ained Heap Size : ĠBoolean Ġ= Ġfalse , ĊĠ Ġreference Matchers : ĠList < Reference Matcher > Ġ= Ġdefault Reference Matchers , ĊĠ Ġmetadata Extractor : ĠMetadata Extractor Ġ= ĠMetadata Extractor . NO _ OP , ĊĠ Ġpro guard Mapping : ĠPro guard Mapping ? Ġ= Ġnull , ĊĠ Ġleak Filters : ĠList < Le aking Object Filter > Ġ= ĠObject Inspect ors . jdk Le aking Object Filters , ĊĠ Ġfile : ĠFile Ġ= ĠFile ("/ no / file ") Ċ ): ĠT Ġ{ ĊĠ Ġval Ġinspect ors Ġ= Ġif Ġ( Object Inspect ors . KEY ED _ WE AK _ REFERENCE Ġ! in Ġobject Inspect ors ) Ġ{ ĊĠĠĠ Ġobject Inspect ors Ġ+ ĠObject Inspect ors . KEY ED _ WE AK _ REFERENCE ĊĠ Ġ} Ġelse Ġ{ ĊĠĠĠ Ġobject Inspect ors ĊĠ Ġ} ĊĠ Ġval Ġheap Analyzer Ġ= ĠHeap Analyzer ( On Analysis Progress Listener . NO _ OP ) ĊĊĠ Ġval Ġresult Ġ= Ġopen Heap Graph ( pro guard Mapping ). use Ġ{ Ġgraph Ġ-> ĊĠĠĠ Ġheap Analyzer . analyze ( ĊĠĠĠĠĠ Ġheap Dump File Ġ= Ġfile , ĊĠĠĠĠĠ Ġgraph Ġ= Ġgraph , ĊĠĠĠĠĠ Ġle aking Object Finder Ġ= ĠFiltering Le aking Object Finder ( leak Filters ), ĊĠĠĠĠĠ Ġreference Matchers Ġ= Ġreference Matchers , ĊĠĠĠĠĠ Ġcompute Ret ained Heap Size Ġ= Ġcompute Ret ained Heap Size , ĊĠĠĠĠĠ Ġobject Inspect ors Ġ= Ġinspect ors , ĊĠĠĠĠĠ Ġmetadata Extractor Ġ= Ġmetadata Extractor , ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĠ Ġif Ġ( result Ġis ĠHeap Analysis Failure ) Ġ{ ĊĠĠĠ Ġprintln ( result ) ĊĠ Ġ} ĊĠ Ġ@ Suppress (" UN CHECK ED _ CAST ") ĊĠ Ġreturn Ġresult Ġas ĠT Ċ } Ċ Ċ fun Ġ< T Ġ: ĠHeap Analysis > ĠFile . check For Le aks ( ĊĠ Ġobject Inspect ors : ĠList < Object Inspector > Ġ= Ġempty List (), ĊĠ Ġcompute Ret ained Heap Size : ĠBoolean Ġ= Ġfalse , ĊĠ Ġreference Matchers : ĠList < Reference Matcher > Ġ= Ġdefault Reference Matchers , ĊĠ Ġmetadata Extractor : ĠMetadata Extractor Ġ= ĠMetadata Extractor . NO _ OP , ĊĠ Ġpro guard Mapping : ĠPro guard Mapping ? Ġ= Ġnull , ĊĠ Ġleak Filters : ĠList < Le aking Object Filter > Ġ= ĠObject Inspect ors . jdk Le aking Object Filters , Ċ ): ĠT Ġ{ ĊĠ Ġreturn ĠFile Source Provider ( this ). check For Le aks ( ĊĠĠĠ Ġobject Inspect ors , Ġcompute Ret ained Heap Size , Ġreference Matchers , Ġmetadata Extractor , ĊĠĠĠ Ġpro guard Mapping , Ġleak Filters , Ġthis ĊĠ Ġ) Ċ } Ċ Ċ val Ġdefault Reference Matchers : ĠList < Reference Matcher > Ġ= ĊĠ ĠlistOf ( ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern ( Weak Reference :: class . java . name , Ġ" refer ent ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern (" leak can ary . Key ed Weak Reference ", Ġ" refer ent ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern ( Soft Reference :: class . java . name , Ġ" refer ent ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern ( Ph antom Reference :: class . java . name , Ġ" refer ent ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern (" java . lang . ref . Final izer ", Ġ" prev ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern (" java . lang . ref . Final izer ", Ġ" element ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern (" java . lang . ref . Final izer ", Ġ" next ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern (" java . lang . ref . Final izer Reference ", Ġ" prev ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern (" java . lang . ref . Final izer Reference ", Ġ" element ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern (" java . lang . ref . Final izer Reference ", Ġ" next ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern (" sun . misc . Clean er ", Ġ" prev ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠInstance Field Pattern (" sun . misc . Clean er ", Ġ" next ") ĊĠĠĠ Ġ), ĊĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠJava Local Pattern (" Final izer Watch dog Daemon ") ĊĠĠĠ Ġ), ĊĠĠĠ ĠIgnore d Reference Matcher ( ĊĠĠĠĠĠ Ġpattern Ġ= ĠJava Local Pattern (" main ") ĊĠĠĠ Ġ) ĊĠ Ġ) Ċ