1098 } |
1098 } |
1099 return delta_words; |
1099 return delta_words; |
1100 } |
1100 } |
1101 |
1101 |
1102 bool MetaspaceGC::should_expand(VirtualSpaceList* vsl, size_t word_size) { |
1102 bool MetaspaceGC::should_expand(VirtualSpaceList* vsl, size_t word_size) { |
|
1103 // If the user wants a limit, impose one. |
|
1104 if (!FLAG_IS_DEFAULT(MaxMetaspaceSize) && |
|
1105 MetaspaceAux::reserved_in_bytes() >= MaxMetaspaceSize) { |
|
1106 return false; |
|
1107 } |
1103 |
1108 |
1104 // Class virtual space should always be expanded. Call GC for the other |
1109 // Class virtual space should always be expanded. Call GC for the other |
1105 // metadata virtual space. |
1110 // metadata virtual space. |
1106 if (vsl == Metaspace::class_space_list()) return true; |
1111 if (vsl == Metaspace::class_space_list()) return true; |
1107 |
|
1108 // If the user wants a limit, impose one. |
|
1109 size_t max_metaspace_size_words = MaxMetaspaceSize / BytesPerWord; |
|
1110 size_t metaspace_size_words = MetaspaceSize / BytesPerWord; |
|
1111 if (!FLAG_IS_DEFAULT(MaxMetaspaceSize) && |
|
1112 vsl->capacity_words_sum() >= max_metaspace_size_words) { |
|
1113 return false; |
|
1114 } |
|
1115 |
1112 |
1116 // If this is part of an allocation after a GC, expand |
1113 // If this is part of an allocation after a GC, expand |
1117 // unconditionally. |
1114 // unconditionally. |
1118 if(MetaspaceGC::expand_after_GC()) { |
1115 if(MetaspaceGC::expand_after_GC()) { |
1119 return true; |
1116 return true; |
1120 } |
1117 } |
|
1118 |
|
1119 size_t metaspace_size_words = MetaspaceSize / BytesPerWord; |
1121 |
1120 |
1122 // If the capacity is below the minimum capacity, allow the |
1121 // If the capacity is below the minimum capacity, allow the |
1123 // expansion. Also set the high-water-mark (capacity_until_GC) |
1122 // expansion. Also set the high-water-mark (capacity_until_GC) |
1124 // to that minimum capacity so that a GC will not be induced |
1123 // to that minimum capacity so that a GC will not be induced |
1125 // until that minimum capacity is exceeded. |
1124 // until that minimum capacity is exceeded. |