Another take on Finalization

Thomas Schatzl thomas.schatzl at oracle.com
Mon Jun 8 07:41:05 UTC 2015


Hi,

On Sun, 2015-06-07 at 10:46 +0200, Peter Levart wrote:
> Hi,
> 
> On 06/05/2015 11:11 PM, Jonathan Payne wrote:
> > My problem was that finalization was not being run at all with the G1
>>collector. Not at all. That would have been fine with me because none
>>of the existing objects in the Finalizer queue actually needed the
>>service anymore: the files, sockets, streams, etc. had all been
>>properly closed by my application, otherwise the server would have
>>long since failed completely. However, those objects started to
>>accumulate in the VM and eventually (8 hours later) brought the server
>>down.
> 
> I made a quick test comparing default (PS MarkSweep / PS Scavenge) and 
> G1 collectors with -Xmx512m option. When finalizable objects are 
> released immediately after construction with a sustained rate of ~90 
> objects/ms, the results for default collector are:
[...]
> ...which suggests that G1 is no less eager to process finalizable 
> objects that are young garbage (see "in-flight" column). At least it 
> doesn't seem that they accumulate. So your problem might have been with 
> finalizable objects escaping to old-gen. Tuning the young-gen size and 
> survivor ratio might help in your case.

  that might have been an artifact of old G1 implementations that did
not do class unloading (and various other cleanups) during the
concurrent marking cycle.

That feature is in the official release since 8u40, so G1 should
definitely also try to finalize objects that escaped into old gen for
some time now, without full gc.

Thanks,
  Thomas





More information about the core-libs-dev mailing list