src/java.base/share/native/libjli/java.c
Print this page
@@ -167,10 +167,17 @@
static jlong threadStackSize = 0; /* stack size of the new thread */
static jlong maxHeapSize = 0; /* max heap size */
static jlong initialHeapSize = 0; /* inital heap size */
/*
+ * A minimum -Xss stack size suitable for all platforms.
+ */
+#ifndef STACK_SIZE_MINIMUM
+#define STACK_SIZE_MINIMUM (32 * KB)
+#endif
+
+/*
* Entry point.
*/
int
JLI_Launch(int argc, char ** argv, /* main argc, argc */
int jargc, const char** jargv, /* java args */
@@ -771,10 +778,18 @@
if (JLI_StrCCmp(str, "-Xss") == 0) {
jlong tmp;
if (parse_size(str + 4, &tmp)) {
threadStackSize = tmp;
+ /*
+ * Make sure the thread stack size is big enough that we won't get a stack
+ * overflow before the JVM startup code can check to make sure the stack
+ * is big enough.
+ */
+ if (threadStackSize < STACK_SIZE_MINIMUM) {
+ threadStackSize = STACK_SIZE_MINIMUM;
+ }
}
}
if (JLI_StrCCmp(str, "-Xmx") == 0) {
jlong tmp;