6850957: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit
authormartin
Mon, 29 Jun 2009 14:42:12 -0700
changeset 3576 4ceec8fb3e18
parent 3575 224791e7ecab
child 3577 488338f3a402
6850957: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit Summary: call report_java_out_of_memory("Requested array size exceeds VM limit") Reviewed-by: tbell, dholmes, alanb, ysr Contributed-by: jeremymanson@google.com
hotspot/src/share/vm/oops/arrayKlass.cpp
hotspot/src/share/vm/oops/instanceKlass.cpp
hotspot/src/share/vm/oops/objArrayKlass.cpp
hotspot/src/share/vm/oops/typeArrayKlass.cpp
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp	Fri Jul 10 11:10:00 2009 -0700
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp	Mon Jun 29 14:42:12 2009 -0700
@@ -140,6 +140,7 @@
     THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
   }
   if (length > arrayOopDesc::max_array_length(T_ARRAY)) {
+    report_java_out_of_memory("Requested array size exceeds VM limit");
     THROW_OOP_0(Universe::out_of_memory_error_array_size());
   }
   int size = objArrayOopDesc::object_size(length);
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Jul 10 11:10:00 2009 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Mon Jun 29 14:42:12 2009 -0700
@@ -508,6 +508,7 @@
 objArrayOop instanceKlass::allocate_objArray(int n, int length, TRAPS) {
   if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
   if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
+    report_java_out_of_memory("Requested array size exceeds VM limit");
     THROW_OOP_0(Universe::out_of_memory_error_array_size());
   }
   int size = objArrayOopDesc::object_size(length);
--- a/hotspot/src/share/vm/oops/objArrayKlass.cpp	Fri Jul 10 11:10:00 2009 -0700
+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp	Mon Jun 29 14:42:12 2009 -0700
@@ -39,6 +39,7 @@
       assert(a->is_parsable(), "Can't publish unless parsable");
       return a;
     } else {
+      report_java_out_of_memory("Requested array size exceeds VM limit");
       THROW_OOP_0(Universe::out_of_memory_error_array_size());
     }
   } else {
--- a/hotspot/src/share/vm/oops/typeArrayKlass.cpp	Fri Jul 10 11:10:00 2009 -0700
+++ b/hotspot/src/share/vm/oops/typeArrayKlass.cpp	Mon Jun 29 14:42:12 2009 -0700
@@ -80,6 +80,7 @@
       assert(t->is_parsable(), "Don't publish unless parsable");
       return t;
     } else {
+      report_java_out_of_memory("Requested array size exceeds VM limit");
       THROW_OOP_0(Universe::out_of_memory_error_array_size());
     }
   } else {