Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @ 941:8b46c4d82093
4957990: Perm heap bloat in JVM
Summary: Treat ProfileData in MDO's as a source of weak, not strong, roots. Fixes the bug for stop-world collection -- the case of concurrent collection will be fixed separately.
Reviewed-by: jcoomes, jmasa, kvn, never
author | ysr |
---|---|
date | Wed, 02 Sep 2009 00:04:29 -0700 |
parents | bd02caa94611 |
children | 54b3b351d6f9 |
comparison
equal
deleted
inserted
replaced
940:8624da129f0b | 941:8b46c4d82093 |
---|---|
100 GenMarkSweep::_preserved_oop_stack = NULL; | 100 GenMarkSweep::_preserved_oop_stack = NULL; |
101 | 101 |
102 GenMarkSweep::_marking_stack = | 102 GenMarkSweep::_marking_stack = |
103 new (ResourceObj::C_HEAP) GrowableArray<oop>(4000, true); | 103 new (ResourceObj::C_HEAP) GrowableArray<oop>(4000, true); |
104 | 104 |
105 size_t size = SystemDictionary::number_of_classes() * 2; | 105 int size = SystemDictionary::number_of_classes() * 2; |
106 GenMarkSweep::_revisit_klass_stack = | 106 GenMarkSweep::_revisit_klass_stack = |
107 new (ResourceObj::C_HEAP) GrowableArray<Klass*>((int)size, true); | 107 new (ResourceObj::C_HEAP) GrowableArray<Klass*>(size, true); |
108 // (#klass/k)^2 for k ~ 10 appears a better fit, but this will have to do | |
109 // for now until we have a chance to work out a more optimal setting. | |
110 GenMarkSweep::_revisit_mdo_stack = | |
111 new (ResourceObj::C_HEAP) GrowableArray<DataLayout*>(size*2, true); | |
112 | |
108 } | 113 } |
109 | 114 |
110 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, | 115 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, |
111 bool clear_all_softrefs) { | 116 bool clear_all_softrefs) { |
112 // Recursively traverse all live objects and mark them | 117 // Recursively traverse all live objects and mark them |
137 // Follow code cache roots (has to be done after system dictionary, | 142 // Follow code cache roots (has to be done after system dictionary, |
138 // assumes all live klasses are marked) | 143 // assumes all live klasses are marked) |
139 CodeCache::do_unloading(&GenMarkSweep::is_alive, | 144 CodeCache::do_unloading(&GenMarkSweep::is_alive, |
140 &GenMarkSweep::keep_alive, | 145 &GenMarkSweep::keep_alive, |
141 purged_class); | 146 purged_class); |
142 GenMarkSweep::follow_stack(); | 147 GenMarkSweep::follow_stack(); |
143 | 148 |
144 // Update subklass/sibling/implementor links of live klasses | 149 // Update subklass/sibling/implementor links of live klasses |
145 GenMarkSweep::follow_weak_klass_links(); | 150 GenMarkSweep::follow_weak_klass_links(); |
146 assert(GenMarkSweep::_marking_stack->is_empty(), | 151 assert(GenMarkSweep::_marking_stack->is_empty(), |
147 "stack should be empty by now"); | 152 "stack should be empty by now"); |
153 | |
154 // Visit memoized MDO's and clear any unmarked weak refs | |
155 GenMarkSweep::follow_mdo_weak_refs(); | |
156 assert(GenMarkSweep::_marking_stack->is_empty(), "just drained"); | |
157 | |
148 | 158 |
149 // Visit symbol and interned string tables and delete unmarked oops | 159 // Visit symbol and interned string tables and delete unmarked oops |
150 SymbolTable::unlink(&GenMarkSweep::is_alive); | 160 SymbolTable::unlink(&GenMarkSweep::is_alive); |
151 StringTable::unlink(&GenMarkSweep::is_alive); | 161 StringTable::unlink(&GenMarkSweep::is_alive); |
152 | 162 |