src/share/vm/memory/metaspace.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hsx-gc Sdiff src/share/vm/memory

src/share/vm/memory/metaspace.cpp

Print this page




1325     // for this allocation.
1326     delta_words = MAX2(delta_words, max_delta_words);
1327     if (delta_words > max_delta_words) {
1328       // This allocation is large but the next ones are probably not
1329       // so increase by the minimum.
1330       delta_words = delta_words + min_delta_words;
1331     }
1332   }
1333   return delta_words;
1334 }
1335 
1336 bool MetaspaceGC::should_expand(VirtualSpaceList* vsl, size_t word_size) {
1337 
1338   // If the user wants a limit, impose one.
1339   // The reason for someone using this flag is to limit reserved space.  So
1340   // for non-class virtual space, compare against virtual spaces that are reserved.
1341   // For class virtual space, we only compare against the committed space, not
1342   // reserved space, because this is a larger space prereserved for compressed
1343   // class pointers.
1344   if (!FLAG_IS_DEFAULT(MaxMetaspaceSize)) {
1345     size_t real_allocated = Metaspace::space_list()->reserved_words() +
1346               MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType);

1347     if (real_allocated >= MaxMetaspaceSize) {
1348       return false;
1349     }
1350   }
1351 
1352   // Class virtual space should always be expanded.  Call GC for the other
1353   // metadata virtual space.
1354   if (Metaspace::using_class_space() &&
1355       (vsl == Metaspace::class_space_list())) return true;
1356 
1357   // If this is part of an allocation after a GC, expand
1358   // unconditionally.
1359   if (MetaspaceGC::expand_after_GC()) {
1360     return true;
1361   }
1362 
1363 
1364   // If the capacity is below the minimum capacity, allow the
1365   // expansion.  Also set the high-water-mark (capacity_until_GC)
1366   // to that minimum capacity so that a GC will not be induced




1325     // for this allocation.
1326     delta_words = MAX2(delta_words, max_delta_words);
1327     if (delta_words > max_delta_words) {
1328       // This allocation is large but the next ones are probably not
1329       // so increase by the minimum.
1330       delta_words = delta_words + min_delta_words;
1331     }
1332   }
1333   return delta_words;
1334 }
1335 
1336 bool MetaspaceGC::should_expand(VirtualSpaceList* vsl, size_t word_size) {
1337 
1338   // If the user wants a limit, impose one.
1339   // The reason for someone using this flag is to limit reserved space.  So
1340   // for non-class virtual space, compare against virtual spaces that are reserved.
1341   // For class virtual space, we only compare against the committed space, not
1342   // reserved space, because this is a larger space prereserved for compressed
1343   // class pointers.
1344   if (!FLAG_IS_DEFAULT(MaxMetaspaceSize)) {
1345     size_t nonclass_allocated = MetaspaceAux::reserved_bytes(Metaspace::NonClassType);
1346     size_t class_allocated    = MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType);
1347     size_t real_allocated     = nonclass_allocated + class_allocated;
1348     if (real_allocated >= MaxMetaspaceSize) {
1349       return false;
1350     }
1351   }
1352 
1353   // Class virtual space should always be expanded.  Call GC for the other
1354   // metadata virtual space.
1355   if (Metaspace::using_class_space() &&
1356       (vsl == Metaspace::class_space_list())) return true;
1357 
1358   // If this is part of an allocation after a GC, expand
1359   // unconditionally.
1360   if (MetaspaceGC::expand_after_GC()) {
1361     return true;
1362   }
1363 
1364 
1365   // If the capacity is below the minimum capacity, allow the
1366   // expansion.  Also set the high-water-mark (capacity_until_GC)
1367   // to that minimum capacity so that a GC will not be induced


src/share/vm/memory/metaspace.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File