6850957: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit
Call report_java_out_of_memory("Requested array size exceeds VM limit") Reviewed-by: tbell, dholmes, alanb, ysr
This commit is contained in:
parent
08f5aeffc1
commit
28d4ad46aa
@ -140,6 +140,7 @@ objArrayOop arrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
|
|||||||
THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
||||||
}
|
}
|
||||||
if (length > arrayOopDesc::max_array_length(T_ARRAY)) {
|
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());
|
THROW_OOP_0(Universe::out_of_memory_error_array_size());
|
||||||
}
|
}
|
||||||
int size = objArrayOopDesc::object_size(length);
|
int size = objArrayOopDesc::object_size(length);
|
||||||
|
@ -508,6 +508,7 @@ bool instanceKlass::implements_interface(klassOop k) const {
|
|||||||
objArrayOop instanceKlass::allocate_objArray(int n, int length, TRAPS) {
|
objArrayOop instanceKlass::allocate_objArray(int n, int length, TRAPS) {
|
||||||
if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
||||||
if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
|
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());
|
THROW_OOP_0(Universe::out_of_memory_error_array_size());
|
||||||
}
|
}
|
||||||
int size = objArrayOopDesc::object_size(length);
|
int size = objArrayOopDesc::object_size(length);
|
||||||
|
@ -39,6 +39,7 @@ objArrayOop objArrayKlass::allocate(int length, TRAPS) {
|
|||||||
assert(a->is_parsable(), "Can't publish unless parsable");
|
assert(a->is_parsable(), "Can't publish unless parsable");
|
||||||
return a;
|
return a;
|
||||||
} else {
|
} else {
|
||||||
|
report_java_out_of_memory("Requested array size exceeds VM limit");
|
||||||
THROW_OOP_0(Universe::out_of_memory_error_array_size());
|
THROW_OOP_0(Universe::out_of_memory_error_array_size());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -80,6 +80,7 @@ typeArrayOop typeArrayKlass::allocate(int length, TRAPS) {
|
|||||||
assert(t->is_parsable(), "Don't publish unless parsable");
|
assert(t->is_parsable(), "Don't publish unless parsable");
|
||||||
return t;
|
return t;
|
||||||
} else {
|
} else {
|
||||||
|
report_java_out_of_memory("Requested array size exceeds VM limit");
|
||||||
THROW_OOP_0(Universe::out_of_memory_error_array_size());
|
THROW_OOP_0(Universe::out_of_memory_error_array_size());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user