1340 // for non-class virtual space, compare against virtual spaces that are reserved. |
1340 // for non-class virtual space, compare against virtual spaces that are reserved. |
1341 // For class virtual space, we only compare against the committed space, not |
1341 // For class virtual space, we only compare against the committed space, not |
1342 // reserved space, because this is a larger space prereserved for compressed |
1342 // reserved space, because this is a larger space prereserved for compressed |
1343 // class pointers. |
1343 // class pointers. |
1344 if (!FLAG_IS_DEFAULT(MaxMetaspaceSize)) { |
1344 if (!FLAG_IS_DEFAULT(MaxMetaspaceSize)) { |
1345 size_t real_allocated = Metaspace::space_list()->reserved_words() + |
1345 size_t nonclass_allocated = MetaspaceAux::reserved_bytes(Metaspace::NonClassType); |
1346 MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType); |
1346 size_t class_allocated = MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType); |
|
1347 size_t real_allocated = nonclass_allocated + class_allocated; |
1347 if (real_allocated >= MaxMetaspaceSize) { |
1348 if (real_allocated >= MaxMetaspaceSize) { |
1348 return false; |
1349 return false; |
1349 } |
1350 } |
1350 } |
1351 } |
1351 |
1352 |