< prev index next >

src/hotspot/share/memory/metaspace.cpp

Print this page




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








3321 }
3322 
3323 void Metaspace::global_initialize() {
3324   MetaspaceGC::initialize();
3325 
3326 #if INCLUDE_CDS
3327   if (DumpSharedSpaces) {
3328     MetaspaceShared::initialize_shared_rs();
3329   } else if (UseSharedSpaces) {
3330     // If using shared space, open the file that contains the shared space
3331     // and map in the memory before initializing the rest of metaspace (so
3332     // the addresses don't conflict)
3333     address cds_address = NULL;
3334     FileMapInfo* mapinfo = new FileMapInfo();
3335 
3336     // Open the shared archive file, read and validate the header. If
3337     // initialization fails, shared spaces [UseSharedSpaces] are
3338     // disabled and the file is closed.
3339     // Map in spaces now also
3340     if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) {




3301   // java.lang.management.MemoryUsage API.
3302   //
3303   // Ideally, we would be able to set the default value of MaxMetaspaceSize in
3304   // globals.hpp to the aligned value, but this is not possible, since the
3305   // alignment depends on other flags being parsed.
3306   MaxMetaspaceSize = align_down_bounded(MaxMetaspaceSize, _reserve_alignment);
3307 
3308   if (MetaspaceSize > MaxMetaspaceSize) {
3309     MetaspaceSize = MaxMetaspaceSize;
3310   }
3311 
3312   MetaspaceSize = align_down_bounded(MetaspaceSize, _commit_alignment);
3313 
3314   assert(MetaspaceSize <= MaxMetaspaceSize, "MetaspaceSize should be limited by MaxMetaspaceSize");
3315 
3316   MinMetaspaceExpansion = align_down_bounded(MinMetaspaceExpansion, _commit_alignment);
3317   MaxMetaspaceExpansion = align_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
3318 
3319   CompressedClassSpaceSize = align_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
3320   set_compressed_class_space_size(CompressedClassSpaceSize);
3321 
3322   size_t min_metaspace_sz = InitialBootClassLoaderMetaspaceSize +
3323                                                 (MediumChunk * HeapWordSize);
3324   if (!UseCompressedClassPointers && (min_metaspace_sz >= MaxMetaspaceSize)) {
3325     FLAG_SET_ERGO(size_t, InitialBootClassLoaderMetaspaceSize,
3326                                                         min_metaspace_sz);
3327   }
3328 
3329 }
3330 
3331 void Metaspace::global_initialize() {
3332   MetaspaceGC::initialize();
3333 
3334 #if INCLUDE_CDS
3335   if (DumpSharedSpaces) {
3336     MetaspaceShared::initialize_shared_rs();
3337   } else if (UseSharedSpaces) {
3338     // If using shared space, open the file that contains the shared space
3339     // and map in the memory before initializing the rest of metaspace (so
3340     // the addresses don't conflict)
3341     address cds_address = NULL;
3342     FileMapInfo* mapinfo = new FileMapInfo();
3343 
3344     // Open the shared archive file, read and validate the header. If
3345     // initialization fails, shared spaces [UseSharedSpaces] are
3346     // disabled and the file is closed.
3347     // Map in spaces now also
3348     if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) {


< prev index next >