src/hotspot/share/gc/shared/genCollectedHeap.cpp
changeset 55576 4d193e40e7af
parent 54786 ebf733a324d4
child 55740 b3ff56f955c8
equal deleted inserted replaced
55575:25165403c62e 55576:4d193e40e7af
   573   const bool do_clear_all_soft_refs = clear_all_soft_refs ||
   573   const bool do_clear_all_soft_refs = clear_all_soft_refs ||
   574                           soft_ref_policy()->should_clear_all_soft_refs();
   574                           soft_ref_policy()->should_clear_all_soft_refs();
   575 
   575 
   576   ClearedAllSoftRefs casr(do_clear_all_soft_refs, soft_ref_policy());
   576   ClearedAllSoftRefs casr(do_clear_all_soft_refs, soft_ref_policy());
   577 
   577 
   578   const size_t metadata_prev_used = MetaspaceUtils::used_bytes();
       
   579 
       
   580 
       
   581   FlagSetting fl(_is_gc_active, true);
   578   FlagSetting fl(_is_gc_active, true);
   582 
   579 
   583   bool complete = full && (max_generation == OldGen);
   580   bool complete = full && (max_generation == OldGen);
   584   bool old_collects_young = complete && !ScavengeBeforeFullGC;
   581   bool old_collects_young = complete && !ScavengeBeforeFullGC;
   585   bool do_young_collection = !old_collects_young && _young_gen->should_collect(full, size, is_tlab);
   582   bool do_young_collection = !old_collects_young && _young_gen->should_collect(full, size, is_tlab);
   586 
   583 
   587   size_t young_prev_used = _young_gen->used();
   584   size_t young_prev_used = _young_gen->used();
   588   size_t old_prev_used = _old_gen->used();
   585   size_t old_prev_used = _old_gen->used();
       
   586   const metaspace::MetaspaceSizesSnapshot prev_meta_sizes;
   589 
   587 
   590   bool run_verification = total_collections() >= VerifyGCStartAt;
   588   bool run_verification = total_collections() >= VerifyGCStartAt;
   591   bool prepared_for_verification = false;
   589   bool prepared_for_verification = false;
   592   bool do_full_collection = false;
   590   bool do_full_collection = false;
   593 
   591 
   626     if (!do_full_collection) {
   624     if (!do_full_collection) {
   627       // Adjust generation sizes.
   625       // Adjust generation sizes.
   628       _young_gen->compute_new_size();
   626       _young_gen->compute_new_size();
   629 
   627 
   630       print_heap_change(young_prev_used, old_prev_used);
   628       print_heap_change(young_prev_used, old_prev_used);
   631       MetaspaceUtils::print_metaspace_change(metadata_prev_used);
   629       MetaspaceUtils::print_metaspace_change(prev_meta_sizes);
   632 
   630 
   633       // Track memory usage and detect low memory after GC finishes
   631       // Track memory usage and detect low memory after GC finishes
   634       MemoryService::track_memory_usage();
   632       MemoryService::track_memory_usage();
   635 
   633 
   636       gc_epilogue(complete);
   634       gc_epilogue(complete);
   685     // Resize the metaspace capacity after full collections
   683     // Resize the metaspace capacity after full collections
   686     MetaspaceGC::compute_new_size();
   684     MetaspaceGC::compute_new_size();
   687     update_full_collections_completed();
   685     update_full_collections_completed();
   688 
   686 
   689     print_heap_change(young_prev_used, old_prev_used);
   687     print_heap_change(young_prev_used, old_prev_used);
   690     MetaspaceUtils::print_metaspace_change(metadata_prev_used);
   688     MetaspaceUtils::print_metaspace_change(prev_meta_sizes);
   691 
   689 
   692     // Track memory usage and detect low memory after GC finishes
   690     // Track memory usage and detect low memory after GC finishes
   693     MemoryService::track_memory_usage();
   691     MemoryService::track_memory_usage();
   694 
   692 
   695     // Need to tell the epilogue code we are done with Full GC, regardless what was
   693     // Need to tell the epilogue code we are done with Full GC, regardless what was