Mercurial > hg > graal-compiler
comparison src/share/vm/memory/genMarkSweep.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. |
27 | 27 |
28 void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, | 28 void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, |
29 bool clear_all_softrefs) { | 29 bool clear_all_softrefs) { |
30 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); | 30 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); |
31 | 31 |
32 GenCollectedHeap* gch = GenCollectedHeap::heap(); | |
33 #ifdef ASSERT | |
34 if (gch->collector_policy()->should_clear_all_soft_refs()) { | |
35 assert(clear_all_softrefs, "Policy should have been checked earlier"); | |
36 } | |
37 #endif | |
38 | |
32 // hook up weak ref data so it can be used during Mark-Sweep | 39 // hook up weak ref data so it can be used during Mark-Sweep |
33 assert(ref_processor() == NULL, "no stomping"); | 40 assert(ref_processor() == NULL, "no stomping"); |
34 assert(rp != NULL, "should be non-NULL"); | 41 assert(rp != NULL, "should be non-NULL"); |
35 _ref_processor = rp; | 42 _ref_processor = rp; |
36 rp->setup_policy(clear_all_softrefs); | 43 rp->setup_policy(clear_all_softrefs); |
42 CodeCache::gc_prologue(); | 49 CodeCache::gc_prologue(); |
43 Threads::gc_prologue(); | 50 Threads::gc_prologue(); |
44 | 51 |
45 // Increment the invocation count for the permanent generation, since it is | 52 // Increment the invocation count for the permanent generation, since it is |
46 // implicitly collected whenever we do a full mark sweep collection. | 53 // implicitly collected whenever we do a full mark sweep collection. |
47 GenCollectedHeap* gch = GenCollectedHeap::heap(); | |
48 gch->perm_gen()->stat_record()->invocations++; | 54 gch->perm_gen()->stat_record()->invocations++; |
49 | 55 |
50 // Capture heap size before collection for printing. | 56 // Capture heap size before collection for printing. |
51 size_t gch_prev_used = gch->used(); | 57 size_t gch_prev_used = gch->used(); |
52 | 58 |