Mercurial > hg > truffle
comparison src/share/vm/memory/universe.cpp @ 11064:de2d15ce3d4a
8015391: NPG: With -XX:+UseCompressedKlassPointers OOME due to exhausted metadata space could occur when metaspace is almost empty
Summary: Allocate medium chunks for class metaspace when class loader has lots of classes
Reviewed-by: mgerdin, jmasa
author | coleenp |
---|---|
date | Tue, 02 Jul 2013 08:42:37 -0400 |
parents | ef57c43512d6 |
children | cedf20e2a655 |
comparison
equal
deleted
inserted
replaced
11028:b3cd8b58b798 | 11064:de2d15ce3d4a |
---|---|
108 oop Universe::_the_min_jint_string = NULL; | 108 oop Universe::_the_min_jint_string = NULL; |
109 LatestMethodOopCache* Universe::_finalizer_register_cache = NULL; | 109 LatestMethodOopCache* Universe::_finalizer_register_cache = NULL; |
110 LatestMethodOopCache* Universe::_loader_addClass_cache = NULL; | 110 LatestMethodOopCache* Universe::_loader_addClass_cache = NULL; |
111 ActiveMethodOopsCache* Universe::_reflect_invoke_cache = NULL; | 111 ActiveMethodOopsCache* Universe::_reflect_invoke_cache = NULL; |
112 oop Universe::_out_of_memory_error_java_heap = NULL; | 112 oop Universe::_out_of_memory_error_java_heap = NULL; |
113 oop Universe::_out_of_memory_error_perm_gen = NULL; | 113 oop Universe::_out_of_memory_error_metaspace = NULL; |
114 oop Universe::_out_of_memory_error_class_metaspace = NULL; | |
114 oop Universe::_out_of_memory_error_array_size = NULL; | 115 oop Universe::_out_of_memory_error_array_size = NULL; |
115 oop Universe::_out_of_memory_error_gc_overhead_limit = NULL; | 116 oop Universe::_out_of_memory_error_gc_overhead_limit = NULL; |
116 objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL; | 117 objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL; |
117 volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0; | 118 volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0; |
118 bool Universe::_verify_in_progress = false; | 119 bool Universe::_verify_in_progress = false; |
177 | 178 |
178 f->do_oop((oop*)&_the_empty_class_klass_array); | 179 f->do_oop((oop*)&_the_empty_class_klass_array); |
179 f->do_oop((oop*)&_the_null_string); | 180 f->do_oop((oop*)&_the_null_string); |
180 f->do_oop((oop*)&_the_min_jint_string); | 181 f->do_oop((oop*)&_the_min_jint_string); |
181 f->do_oop((oop*)&_out_of_memory_error_java_heap); | 182 f->do_oop((oop*)&_out_of_memory_error_java_heap); |
182 f->do_oop((oop*)&_out_of_memory_error_perm_gen); | 183 f->do_oop((oop*)&_out_of_memory_error_metaspace); |
184 f->do_oop((oop*)&_out_of_memory_error_class_metaspace); | |
183 f->do_oop((oop*)&_out_of_memory_error_array_size); | 185 f->do_oop((oop*)&_out_of_memory_error_array_size); |
184 f->do_oop((oop*)&_out_of_memory_error_gc_overhead_limit); | 186 f->do_oop((oop*)&_out_of_memory_error_gc_overhead_limit); |
185 f->do_oop((oop*)&_preallocated_out_of_memory_error_array); | 187 f->do_oop((oop*)&_preallocated_out_of_memory_error_array); |
186 f->do_oop((oop*)&_null_ptr_exception_instance); | 188 f->do_oop((oop*)&_null_ptr_exception_instance); |
187 f->do_oop((oop*)&_arithmetic_exception_instance); | 189 f->do_oop((oop*)&_arithmetic_exception_instance); |
559 // backtrace. These errors are kept alive forever and may be "re-used" when all | 561 // backtrace. These errors are kept alive forever and may be "re-used" when all |
560 // preallocated errors with backtrace have been consumed. Also need to avoid | 562 // preallocated errors with backtrace have been consumed. Also need to avoid |
561 // a potential loop which could happen if an out of memory occurs when attempting | 563 // a potential loop which could happen if an out of memory occurs when attempting |
562 // to allocate the backtrace. | 564 // to allocate the backtrace. |
563 return ((throwable() != Universe::_out_of_memory_error_java_heap) && | 565 return ((throwable() != Universe::_out_of_memory_error_java_heap) && |
564 (throwable() != Universe::_out_of_memory_error_perm_gen) && | 566 (throwable() != Universe::_out_of_memory_error_metaspace) && |
567 (throwable() != Universe::_out_of_memory_error_class_metaspace) && | |
565 (throwable() != Universe::_out_of_memory_error_array_size) && | 568 (throwable() != Universe::_out_of_memory_error_array_size) && |
566 (throwable() != Universe::_out_of_memory_error_gc_overhead_limit)); | 569 (throwable() != Universe::_out_of_memory_error_gc_overhead_limit)); |
567 } | 570 } |
568 | 571 |
569 | 572 |
1009 | 1012 |
1010 // Setup preallocated OutOfMemoryError errors | 1013 // Setup preallocated OutOfMemoryError errors |
1011 k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_OutOfMemoryError(), true, CHECK_false); | 1014 k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_OutOfMemoryError(), true, CHECK_false); |
1012 k_h = instanceKlassHandle(THREAD, k); | 1015 k_h = instanceKlassHandle(THREAD, k); |
1013 Universe::_out_of_memory_error_java_heap = k_h->allocate_instance(CHECK_false); | 1016 Universe::_out_of_memory_error_java_heap = k_h->allocate_instance(CHECK_false); |
1014 Universe::_out_of_memory_error_perm_gen = k_h->allocate_instance(CHECK_false); | 1017 Universe::_out_of_memory_error_metaspace = k_h->allocate_instance(CHECK_false); |
1018 Universe::_out_of_memory_error_class_metaspace = k_h->allocate_instance(CHECK_false); | |
1015 Universe::_out_of_memory_error_array_size = k_h->allocate_instance(CHECK_false); | 1019 Universe::_out_of_memory_error_array_size = k_h->allocate_instance(CHECK_false); |
1016 Universe::_out_of_memory_error_gc_overhead_limit = | 1020 Universe::_out_of_memory_error_gc_overhead_limit = |
1017 k_h->allocate_instance(CHECK_false); | 1021 k_h->allocate_instance(CHECK_false); |
1018 | 1022 |
1019 // Setup preallocated NullPointerException | 1023 // Setup preallocated NullPointerException |
1042 // We prefer to not handle this generally, so we always reinitialize these detail messages. | 1046 // We prefer to not handle this generally, so we always reinitialize these detail messages. |
1043 Handle msg = java_lang_String::create_from_str("Java heap space", CHECK_false); | 1047 Handle msg = java_lang_String::create_from_str("Java heap space", CHECK_false); |
1044 java_lang_Throwable::set_message(Universe::_out_of_memory_error_java_heap, msg()); | 1048 java_lang_Throwable::set_message(Universe::_out_of_memory_error_java_heap, msg()); |
1045 | 1049 |
1046 msg = java_lang_String::create_from_str("Metadata space", CHECK_false); | 1050 msg = java_lang_String::create_from_str("Metadata space", CHECK_false); |
1047 java_lang_Throwable::set_message(Universe::_out_of_memory_error_perm_gen, msg()); | 1051 java_lang_Throwable::set_message(Universe::_out_of_memory_error_metaspace, msg()); |
1052 msg = java_lang_String::create_from_str("Class Metadata space", CHECK_false); | |
1053 java_lang_Throwable::set_message(Universe::_out_of_memory_error_class_metaspace, msg()); | |
1048 | 1054 |
1049 msg = java_lang_String::create_from_str("Requested array size exceeds VM limit", CHECK_false); | 1055 msg = java_lang_String::create_from_str("Requested array size exceeds VM limit", CHECK_false); |
1050 java_lang_Throwable::set_message(Universe::_out_of_memory_error_array_size, msg()); | 1056 java_lang_Throwable::set_message(Universe::_out_of_memory_error_array_size, msg()); |
1051 | 1057 |
1052 msg = java_lang_String::create_from_str("GC overhead limit exceeded", CHECK_false); | 1058 msg = java_lang_String::create_from_str("GC overhead limit exceeded", CHECK_false); |