Mercurial > hg > truffle
comparison src/share/vm/memory/metaspace.cpp @ 8790:7f0cb32dd233
8004241: NPG: Metaspace occupies more memory than specified by -XX:MaxMetaspaceSize option
Summary: Enforce MaxMetaspaceSize for both metaspace parts, check MaxMetaspaceSize against "reserved", not "capacity"
Reviewed-by: jmasa, johnc
author | mgerdin |
---|---|
date | Thu, 21 Mar 2013 09:07:43 +0100 |
parents | 19f9fabd94cc |
children | 47902e9acb3a |
comparison
equal
deleted
inserted
replaced
8789:1179172e9ec9 | 8790:7f0cb32dd233 |
---|---|
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. |