6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places

Enhance the error reporting mechanism to help user to fix the problem rather than making it look like a VM error.

Reviewed-by: kvn, kamg
This commit is contained in:
Coleen Phillimore 2011-01-03 14:09:11 -05:00
parent dd59086fcc
commit dec384330b
6 changed files with 71 additions and 23 deletions

View file

@ -2297,14 +2297,15 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
} else if (match_option(option, "-Xoss", &tail)) {
// HotSpot does not have separate native and Java stacks, ignore silently for compatibility
// -Xmaxjitcodesize
} else if (match_option(option, "-Xmaxjitcodesize", &tail)) {
} else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
julong long_ReservedCodeCacheSize = 0;
ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize,
(size_t)InitialCodeCacheSize);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid maximum code cache size: %s\n",
option->optionString);
"Invalid maximum code cache size: %s. Should be greater than InitialCodeCacheSize=%dK\n",
option->optionString, InitialCodeCacheSize/K);
describe_range_error(errcode);
return JNI_EINVAL;
}