Mercurial > hg > graal-jvmci-8
diff src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @ 1387:0bfd3fb24150
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
Summary: Ensure a full GC that clears SoftReferences before throwing an out-of-memory
Reviewed-by: ysr, jcoomes
author | jmasa |
---|---|
date | Tue, 13 Apr 2010 13:52:10 -0700 |
parents | 2a1472c30599 |
children | c18cbe5936b8 |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Fri Apr 09 13:08:34 2010 -0400 +++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Tue Apr 13 13:52:10 2010 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,12 @@ bool clear_all_softrefs) { assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); + SharedHeap* sh = SharedHeap::heap(); +#ifdef ASSERT + if (sh->collector_policy()->should_clear_all_soft_refs()) { + assert(clear_all_softrefs, "Policy should have been checked earler"); + } +#endif // hook up weak ref data so it can be used during Mark-Sweep assert(GenMarkSweep::ref_processor() == NULL, "no stomping"); assert(rp != NULL, "should be non-NULL"); @@ -44,7 +50,6 @@ // Increment the invocation count for the permanent generation, since it is // implicitly collected whenever we do a full mark sweep collection. - SharedHeap* sh = SharedHeap::heap(); sh->perm_gen()->stat_record()->invocations++; bool marked_for_unloading = false;