--- a/hotspot/src/share/vm/memory/metaspace.cpp Wed Oct 22 22:37:06 2014 +0000
+++ b/hotspot/src/share/vm/memory/metaspace.cpp Thu Oct 23 10:08:02 2014 -0700
@@ -3157,6 +3157,16 @@
SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment);
SharedMiscCodeSize = align_size_up(SharedMiscCodeSize, max_alignment);
+ // the min_misc_code_size estimate is based on MetaspaceShared::generate_vtable_methods()
+ uintx min_misc_code_size = align_size_up(
+ (MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size) *
+ (sizeof(void*) + MetaspaceShared::vtbl_method_size) + MetaspaceShared::vtbl_common_code_size,
+ max_alignment);
+
+ if (SharedMiscCodeSize < min_misc_code_size) {
+ report_out_of_shared_space(SharedMiscCode);
+ }
+
// Initialize with the sum of the shared space sizes. The read-only
// and read write metaspace chunks will be allocated out of this and the
// remainder is the misc code and data chunks.