Calling Runtime.gc twice

Kirk Pepperdine kirk at kodewerk.com
Fri Mar 31 20:45:46 UTC 2017


Most likely the second GC is reclaiming Reference types identified during the first collection. Finalization is a likely candidate as it take one collection to get it into the reference queue, the queue is then process and the finalized object can finally be reclaimed.

Kind regards,
Kirk Pepperdine

> On Mar 31, 2017, at 8:53 PM, David Sinclair <dsinclair at chariotsolutions.com> wrote:
> 
> Hi all,
> 
> I was hoping for an explanation of why calling Runtime.gc() twice shows a significant improvement in memory reclaimed as opposed to calling it once.
> 
> Thanks
> 
> dave 



More information about the hotspot-gc-dev mailing list