Tweaking retained size

Questions about YourKit Java Profiler
Post Reply
calavera
Posts: 2
Joined: Mon Jan 25, 2016 1:55 pm

Tweaking retained size

Post by calavera »

Hi,

Is it possible to influence how a retained size is calculated?

1. I'm analysing an object whose many properties have alternative paths to GC root so they are not included in retained size. The alternative path however leads through just one other object. Can I disable this alternative reference for the the purpose of calculation of more informative retained size?

2. In https://www.yourkit.com/docs/java/help/sizes.jsp there is an formulation that retained size represents the amount of memory that will be freed by the garbage collector when this object is collected. This is not exactly true because the calculation does not differ between hard and weak references. So even when the alternative path to GC root for an object leads via weak reference, the object is not counted to retained size although it would be freed if the primary reference is removed. Is it possible to modify this behavior?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Tweaking retained size

Post by Anton Katilin »

Hi,

1. No, but you can analyze alternate paths to GC roots by excluding particular references:
https://www.yourkit.com/docs/java/help/paths.jsp

2. You can null non-strong references on snapshot loading by specifying the following properties in <profiler dir>/bin/ui.ini (for version 2015) or <user home>/.yjp/ui.ini (for the EAP):

Code: Select all

    -Dyjp.keep.weak.refs=false
    -Dyjp.keep.soft.refs=false
    -Dyjp.keep.finalizer.refs=false
Please note that you must manually delete <snapshot>.idom file after applying/changing these options and open the snapshot anew.
calavera
Posts: 2
Joined: Mon Jan 25, 2016 1:55 pm

Re: Tweaking retained size

Post by calavera »

Thanks, ui.ini settings worked great and is extremely useful.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Tweaking retained size

Post by Anton Katilin »

Thank you for the feedback.
Post Reply