157 VerifyBeforeGC) {
158 old_gen->verify_object_start_array();
159 }
160
161 // Filled in below to track the state of the young gen after the collection.
162 bool eden_empty;
163 bool survivors_empty;
164 bool young_gen_empty;
165
166 {
167 HandleMark hm;
168
169 GCTraceCPUTime tcpu;
170 GCTraceTime(Info, gc) t("Pause Full", NULL, gc_cause, true);
171
172 heap->pre_full_gc_dump(_gc_timer);
173
174 TraceCollectorStats tcs(counters());
175 TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
176
177 if (TraceOldGenTime) accumulated_time()->start();
178
179 // Let the size policy know we're starting
180 size_policy->major_collection_begin();
181
182 CodeCache::gc_prologue();
183 BiasedLocking::preserve_marks();
184
185 // Capture metadata size before collection for sizing.
186 size_t metadata_prev_used = MetaspaceAux::used_bytes();
187
188 size_t old_gen_prev_used = old_gen->used_in_bytes();
189 size_t young_gen_prev_used = young_gen->used_in_bytes();
190
191 allocate_stacks();
192
193 #if defined(COMPILER2) || INCLUDE_JVMCI
194 DerivedPointerTable::clear();
195 #endif
196
197 ref_processor()->enable_discovery();
326
327 heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
328 size_policy->calculated_survivor_size_in_bytes());
329 }
330 log_debug(gc, ergo)("AdaptiveSizeStop: collection: %d ", heap->total_collections());
331 }
332
333 if (UsePerfData) {
334 heap->gc_policy_counters()->update_counters();
335 heap->gc_policy_counters()->update_old_capacity(
336 old_gen->capacity_in_bytes());
337 heap->gc_policy_counters()->update_young_capacity(
338 young_gen->capacity_in_bytes());
339 }
340
341 heap->resize_all_tlabs();
342
343 // We collected the heap, recalculate the metaspace capacity
344 MetaspaceGC::compute_new_size();
345
346 if (TraceOldGenTime) accumulated_time()->stop();
347
348 young_gen->print_used_change(young_gen_prev_used);
349 old_gen->print_used_change(old_gen_prev_used);
350 MetaspaceAux::print_metaspace_change(metadata_prev_used);
351
352 // Track memory usage and detect low memory
353 MemoryService::track_memory_usage();
354 heap->update_counters();
355
356 heap->post_full_gc_dump(_gc_timer);
357 }
358
359 if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
360 HandleMark hm; // Discard invalid handles created during verification
361 Universe::verify("After GC");
362 }
363
364 // Re-verify object start arrays
365 if (VerifyObjectStartArray &&
366 VerifyAfterGC) {
|
157 VerifyBeforeGC) {
158 old_gen->verify_object_start_array();
159 }
160
161 // Filled in below to track the state of the young gen after the collection.
162 bool eden_empty;
163 bool survivors_empty;
164 bool young_gen_empty;
165
166 {
167 HandleMark hm;
168
169 GCTraceCPUTime tcpu;
170 GCTraceTime(Info, gc) t("Pause Full", NULL, gc_cause, true);
171
172 heap->pre_full_gc_dump(_gc_timer);
173
174 TraceCollectorStats tcs(counters());
175 TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
176
177 if (log_is_enabled(Debug, gc, heap, exit)) accumulated_time()->start();
178
179 // Let the size policy know we're starting
180 size_policy->major_collection_begin();
181
182 CodeCache::gc_prologue();
183 BiasedLocking::preserve_marks();
184
185 // Capture metadata size before collection for sizing.
186 size_t metadata_prev_used = MetaspaceAux::used_bytes();
187
188 size_t old_gen_prev_used = old_gen->used_in_bytes();
189 size_t young_gen_prev_used = young_gen->used_in_bytes();
190
191 allocate_stacks();
192
193 #if defined(COMPILER2) || INCLUDE_JVMCI
194 DerivedPointerTable::clear();
195 #endif
196
197 ref_processor()->enable_discovery();
326
327 heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
328 size_policy->calculated_survivor_size_in_bytes());
329 }
330 log_debug(gc, ergo)("AdaptiveSizeStop: collection: %d ", heap->total_collections());
331 }
332
333 if (UsePerfData) {
334 heap->gc_policy_counters()->update_counters();
335 heap->gc_policy_counters()->update_old_capacity(
336 old_gen->capacity_in_bytes());
337 heap->gc_policy_counters()->update_young_capacity(
338 young_gen->capacity_in_bytes());
339 }
340
341 heap->resize_all_tlabs();
342
343 // We collected the heap, recalculate the metaspace capacity
344 MetaspaceGC::compute_new_size();
345
346 if (log_is_enabled(Debug, gc, heap, exit)) accumulated_time()->stop();
347
348 young_gen->print_used_change(young_gen_prev_used);
349 old_gen->print_used_change(old_gen_prev_used);
350 MetaspaceAux::print_metaspace_change(metadata_prev_used);
351
352 // Track memory usage and detect low memory
353 MemoryService::track_memory_usage();
354 heap->update_counters();
355
356 heap->post_full_gc_dump(_gc_timer);
357 }
358
359 if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
360 HandleMark hm; // Discard invalid handles created during verification
361 Universe::verify("After GC");
362 }
363
364 // Re-verify object start arrays
365 if (VerifyObjectStartArray &&
366 VerifyAfterGC) {
|