154 VerifyBeforeGC) {
155 old_gen->verify_object_start_array();
156 }
157
158 heap->pre_full_gc_dump(_gc_timer);
159
160 // Filled in below to track the state of the young gen after the collection.
161 bool eden_empty;
162 bool survivors_empty;
163 bool young_gen_empty;
164
165 {
166 HandleMark hm;
167
168 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
169 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
170 GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL);
171 TraceCollectorStats tcs(counters());
172 TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
173
174 if (TraceGen1Time) accumulated_time()->start();
175
176 // Let the size policy know we're starting
177 size_policy->major_collection_begin();
178
179 CodeCache::gc_prologue();
180 Threads::gc_prologue();
181 BiasedLocking::preserve_marks();
182
183 // Capture heap size before collection for printing.
184 size_t prev_used = heap->used();
185
186 // Capture metadata size before collection for sizing.
187 size_t metadata_prev_used = MetaspaceAux::used_bytes();
188
189 // For PrintGCDetails
190 size_t old_gen_prev_used = old_gen->used_in_bytes();
191 size_t young_gen_prev_used = young_gen->used_in_bytes();
192
193 allocate_stacks();
194
334 }
335 if (PrintAdaptiveSizePolicy) {
336 gclog_or_tty->print_cr("AdaptiveSizeStop: collection: %d ",
337 heap->total_collections());
338 }
339 }
340
341 if (UsePerfData) {
342 heap->gc_policy_counters()->update_counters();
343 heap->gc_policy_counters()->update_old_capacity(
344 old_gen->capacity_in_bytes());
345 heap->gc_policy_counters()->update_young_capacity(
346 young_gen->capacity_in_bytes());
347 }
348
349 heap->resize_all_tlabs();
350
351 // We collected the heap, recalculate the metaspace capacity
352 MetaspaceGC::compute_new_size();
353
354 if (TraceGen1Time) accumulated_time()->stop();
355
356 if (PrintGC) {
357 if (PrintGCDetails) {
358 // Don't print a GC timestamp here. This is after the GC so
359 // would be confusing.
360 young_gen->print_used_change(young_gen_prev_used);
361 old_gen->print_used_change(old_gen_prev_used);
362 }
363 heap->print_heap_change(prev_used);
364 if (PrintGCDetails) {
365 MetaspaceAux::print_metaspace_change(metadata_prev_used);
366 }
367 }
368
369 // Track memory usage and detect low memory
370 MemoryService::track_memory_usage();
371 heap->update_counters();
372 }
373
374 if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
|
154 VerifyBeforeGC) {
155 old_gen->verify_object_start_array();
156 }
157
158 heap->pre_full_gc_dump(_gc_timer);
159
160 // Filled in below to track the state of the young gen after the collection.
161 bool eden_empty;
162 bool survivors_empty;
163 bool young_gen_empty;
164
165 {
166 HandleMark hm;
167
168 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
169 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
170 GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL);
171 TraceCollectorStats tcs(counters());
172 TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
173
174 if (TraceOldGenTime) accumulated_time()->start();
175
176 // Let the size policy know we're starting
177 size_policy->major_collection_begin();
178
179 CodeCache::gc_prologue();
180 Threads::gc_prologue();
181 BiasedLocking::preserve_marks();
182
183 // Capture heap size before collection for printing.
184 size_t prev_used = heap->used();
185
186 // Capture metadata size before collection for sizing.
187 size_t metadata_prev_used = MetaspaceAux::used_bytes();
188
189 // For PrintGCDetails
190 size_t old_gen_prev_used = old_gen->used_in_bytes();
191 size_t young_gen_prev_used = young_gen->used_in_bytes();
192
193 allocate_stacks();
194
334 }
335 if (PrintAdaptiveSizePolicy) {
336 gclog_or_tty->print_cr("AdaptiveSizeStop: collection: %d ",
337 heap->total_collections());
338 }
339 }
340
341 if (UsePerfData) {
342 heap->gc_policy_counters()->update_counters();
343 heap->gc_policy_counters()->update_old_capacity(
344 old_gen->capacity_in_bytes());
345 heap->gc_policy_counters()->update_young_capacity(
346 young_gen->capacity_in_bytes());
347 }
348
349 heap->resize_all_tlabs();
350
351 // We collected the heap, recalculate the metaspace capacity
352 MetaspaceGC::compute_new_size();
353
354 if (TraceOldGenTime) accumulated_time()->stop();
355
356 if (PrintGC) {
357 if (PrintGCDetails) {
358 // Don't print a GC timestamp here. This is after the GC so
359 // would be confusing.
360 young_gen->print_used_change(young_gen_prev_used);
361 old_gen->print_used_change(old_gen_prev_used);
362 }
363 heap->print_heap_change(prev_used);
364 if (PrintGCDetails) {
365 MetaspaceAux::print_metaspace_change(metadata_prev_used);
366 }
367 }
368
369 // Track memory usage and detect low memory
370 MemoryService::track_memory_usage();
371 heap->update_counters();
372 }
373
374 if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
|