Mercurial > hg > graal-jvmci-8
comparison 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 |
comparison
equal
deleted
inserted
replaced
1361:6b73e879f1c2 | 1387:0bfd3fb24150 |
---|---|
1 /* | 1 /* |
2 * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
29 | 29 |
30 void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, | 30 void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, |
31 bool clear_all_softrefs) { | 31 bool clear_all_softrefs) { |
32 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); | 32 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); |
33 | 33 |
34 SharedHeap* sh = SharedHeap::heap(); | |
35 #ifdef ASSERT | |
36 if (sh->collector_policy()->should_clear_all_soft_refs()) { | |
37 assert(clear_all_softrefs, "Policy should have been checked earler"); | |
38 } | |
39 #endif | |
34 // hook up weak ref data so it can be used during Mark-Sweep | 40 // hook up weak ref data so it can be used during Mark-Sweep |
35 assert(GenMarkSweep::ref_processor() == NULL, "no stomping"); | 41 assert(GenMarkSweep::ref_processor() == NULL, "no stomping"); |
36 assert(rp != NULL, "should be non-NULL"); | 42 assert(rp != NULL, "should be non-NULL"); |
37 GenMarkSweep::_ref_processor = rp; | 43 GenMarkSweep::_ref_processor = rp; |
38 rp->setup_policy(clear_all_softrefs); | 44 rp->setup_policy(clear_all_softrefs); |
42 CodeCache::gc_prologue(); | 48 CodeCache::gc_prologue(); |
43 Threads::gc_prologue(); | 49 Threads::gc_prologue(); |
44 | 50 |
45 // Increment the invocation count for the permanent generation, since it is | 51 // Increment the invocation count for the permanent generation, since it is |
46 // implicitly collected whenever we do a full mark sweep collection. | 52 // implicitly collected whenever we do a full mark sweep collection. |
47 SharedHeap* sh = SharedHeap::heap(); | |
48 sh->perm_gen()->stat_record()->invocations++; | 53 sh->perm_gen()->stat_record()->invocations++; |
49 | 54 |
50 bool marked_for_unloading = false; | 55 bool marked_for_unloading = false; |
51 | 56 |
52 allocate_stacks(); | 57 allocate_stacks(); |