comparison src/share/vm/memory/metaspace.cpp @ 6736:11fb740ce98f

7196103: NPG: Unable to allocate bit map for parallel garbage collection for the requested heap size Summary: Don't allocate huge class metaspace size by default on x64 Reviewed-by: stefank, jmasa, kvn
author coleenp
date Fri, 07 Sep 2012 16:42:25 -0400
parents 942bb29b20b0
children 8da5e203b993
comparison
equal deleted inserted replaced
6735:aed758eda82a 6736:11fb740ce98f
2777 // The reserved space size may be bigger because of alignment, esp with UseLargePages 2777 // The reserved space size may be bigger because of alignment, esp with UseLargePages
2778 assert(rs.size() >= ClassMetaspaceSize, err_msg("%d != %d", rs.size(), ClassMetaspaceSize)); 2778 assert(rs.size() >= ClassMetaspaceSize, err_msg("%d != %d", rs.size(), ClassMetaspaceSize));
2779 _class_space_list = new VirtualSpaceList(rs); 2779 _class_space_list = new VirtualSpaceList(rs);
2780 } 2780 }
2781 2781
2782 // Class space probably needs a lot less than data space
2783 const int class_space_divisor = 4;
2784 2782
2785 void Metaspace::initialize(Mutex* lock, size_t initial_size) { 2783 void Metaspace::initialize(Mutex* lock, size_t initial_size) {
2786 // Use SmallChunk size if not specified, adjust class to smaller size if so. 2784 // Use SmallChunk size if not specified. If specified, use this size for
2785 // the data metaspace.
2787 size_t word_size; 2786 size_t word_size;
2788 size_t class_word_size; 2787 size_t class_word_size;
2789 if (initial_size == 0) { 2788 if (initial_size == 0) {
2790 word_size = (size_t) SpaceManager::SmallChunk; 2789 word_size = (size_t) SpaceManager::SmallChunk;
2791 class_word_size = word_size; 2790 class_word_size = (size_t) SpaceManager::SmallChunk;
2792 } else { 2791 } else {
2793 word_size = initial_size; 2792 word_size = initial_size;
2794 class_word_size = initial_size/class_space_divisor; 2793 // Make the first class chunk bigger than a medium chunk so it's not put
2794 // on the medium chunk list. The next chunk will be small and progress
2795 // from there. This size calculated by -version.
2796 class_word_size = MIN2((size_t)SpaceManager::MediumChunk*5,
2797 (ClassMetaspaceSize/BytesPerWord)*2);
2795 } 2798 }
2796 2799
2797 assert(space_list() != NULL, 2800 assert(space_list() != NULL,
2798 "Metadata VirtualSpaceList has not been initialized"); 2801 "Metadata VirtualSpaceList has not been initialized");
2799 2802