< prev index next >

src/hotspot/share/memory/metaspace.cpp

Print this page




3307   // java.lang.management.MemoryUsage API.
3308   //
3309   // Ideally, we would be able to set the default value of MaxMetaspaceSize in
3310   // globals.hpp to the aligned value, but this is not possible, since the
3311   // alignment depends on other flags being parsed.
3312   MaxMetaspaceSize = align_down_bounded(MaxMetaspaceSize, _reserve_alignment);
3313 
3314   if (MetaspaceSize > MaxMetaspaceSize) {
3315     MetaspaceSize = MaxMetaspaceSize;
3316   }
3317 
3318   MetaspaceSize = align_down_bounded(MetaspaceSize, _commit_alignment);
3319 
3320   assert(MetaspaceSize <= MaxMetaspaceSize, "MetaspaceSize should be limited by MaxMetaspaceSize");
3321 
3322   MinMetaspaceExpansion = align_down_bounded(MinMetaspaceExpansion, _commit_alignment);
3323   MaxMetaspaceExpansion = align_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
3324 
3325   CompressedClassSpaceSize = align_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
3326   set_compressed_class_space_size(CompressedClassSpaceSize);











3327 }
3328 
3329 void Metaspace::global_initialize() {
3330   MetaspaceGC::initialize();
3331 
3332 #if INCLUDE_CDS
3333   if (DumpSharedSpaces) {
3334     MetaspaceShared::initialize_dumptime_shared_and_meta_spaces();
3335   } else if (UseSharedSpaces) {
3336     // If any of the archived space fails to map, UseSharedSpaces
3337     // is reset to false. Fall through to the
3338     // (!DumpSharedSpaces && !UseSharedSpaces) case to set up class
3339     // metaspace.
3340     MetaspaceShared::initialize_runtime_shared_and_meta_spaces();
3341   }
3342 
3343   if (!DumpSharedSpaces && !UseSharedSpaces)
3344 #endif // INCLUDE_CDS
3345   {
3346 #ifdef _LP64




3307   // java.lang.management.MemoryUsage API.
3308   //
3309   // Ideally, we would be able to set the default value of MaxMetaspaceSize in
3310   // globals.hpp to the aligned value, but this is not possible, since the
3311   // alignment depends on other flags being parsed.
3312   MaxMetaspaceSize = align_down_bounded(MaxMetaspaceSize, _reserve_alignment);
3313 
3314   if (MetaspaceSize > MaxMetaspaceSize) {
3315     MetaspaceSize = MaxMetaspaceSize;
3316   }
3317 
3318   MetaspaceSize = align_down_bounded(MetaspaceSize, _commit_alignment);
3319 
3320   assert(MetaspaceSize <= MaxMetaspaceSize, "MetaspaceSize should be limited by MaxMetaspaceSize");
3321 
3322   MinMetaspaceExpansion = align_down_bounded(MinMetaspaceExpansion, _commit_alignment);
3323   MaxMetaspaceExpansion = align_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
3324 
3325   CompressedClassSpaceSize = align_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
3326   set_compressed_class_space_size(CompressedClassSpaceSize);
3327 
3328   size_t min_metaspace_sz = calculate_min_metaspace_size();
3329   if (!UseCompressedClassPointers && (min_metaspace_sz >= MaxMetaspaceSize)) {
3330     FLAG_SET_ERGO(size_t, InitialBootClassLoaderMetaspaceSize,
3331                                                         min_metaspace_sz);
3332   }
3333 
3334 }
3335 
3336 size_t Metaspace::calculate_min_metaspace_size() {
3337   return InitialBootClassLoaderMetaspaceSize + (MediumChunk * HeapWordSize);
3338 }
3339 
3340 void Metaspace::global_initialize() {
3341   MetaspaceGC::initialize();
3342 
3343 #if INCLUDE_CDS
3344   if (DumpSharedSpaces) {
3345     MetaspaceShared::initialize_dumptime_shared_and_meta_spaces();
3346   } else if (UseSharedSpaces) {
3347     // If any of the archived space fails to map, UseSharedSpaces
3348     // is reset to false. Fall through to the
3349     // (!DumpSharedSpaces && !UseSharedSpaces) case to set up class
3350     // metaspace.
3351     MetaspaceShared::initialize_runtime_shared_and_meta_spaces();
3352   }
3353 
3354   if (!DumpSharedSpaces && !UseSharedSpaces)
3355 #endif // INCLUDE_CDS
3356   {
3357 #ifdef _LP64


< prev index next >