8067187: -XX:MaxMetaspaceSize=20m -Xshare:dump caused JVM to crash

Added check for the MaxMetaspaceSize. If it is less than the estimated required size, print an error and exit.

Reviewed-by: jiangli, mseledtsov, stefank
This commit is contained in:
Calvin Cheung 2015-01-12 11:37:58 -08:00
parent 4e84bf1e93
commit 9000f8c3c7
4 changed files with 65 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -273,6 +273,14 @@ void report_out_of_shared_space(SharedSpaceType shared_space) {
exit(2);
}
void report_insufficient_metaspace(size_t required_size) {
warning("\nThe MaxMetaspaceSize of " UINTX_FORMAT " bytes is not large enough.\n"
"Either don't specify the -XX:MaxMetaspaceSize=<size>\n"
"or increase the size to at least " SIZE_FORMAT ".\n",
MaxMetaspaceSize, required_size);
exit(2);
}
void report_java_out_of_memory(const char* message) {
static jint out_of_memory_reported = 0;