RFR: 8236569: -Xss not multiple of 4K does not work for the main thread on macOS
Henry Jen
henryjen at openjdk.java.net
Fri May 28 22:04:31 UTC 2021
…d on macOS
This patch simply round up the specified stack size to multiple of the system page size.
Test is trivial, simply run java with -Xss option against following code. On MacOS, before the fix, running with `-Xss159k` and `-Xss160k` would get `7183` and `649` respectively. After fix, both would output `649`, while `-Xss161k` would be same as `-Xss164k` and see 691 as the output.
```code:java
public class StackLeak {
public int depth = 0;
public void stackLeak() {
depth++;
stackLeak();
}
public static void main(String[] args) {
var test = new StackLeak();
try {
test.stackLeak();
} catch (Throwable e) {
System.out.println(test.depth);
}
}
}
-------------
Commit messages:
- JDK-8236569: -Xss not multiple of 4K does not work for the main thread on macOS
Changes: https://git.openjdk.java.net/jdk/pull/4256/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4256&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8236569
Stats: 23 lines in 2 files changed: 21 ins; 0 del; 2 mod
Patch: https://git.openjdk.java.net/jdk/pull/4256.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4256/head:pull/4256
PR: https://git.openjdk.java.net/jdk/pull/4256
More information about the core-libs-dev
mailing list