On Tue, 8 Jun 2021 16:53:38 GMT, Henry Jen <henry...@openjdk.org> wrote:

>> …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);
>>         }
>>     }
>> }
>
> Henry Jen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update help text

Marked as reviewed by alanb (Reviewer).

src/java.base/unix/native/libjli/java_md.c line 681:

> 679: 
> 680:     if (stack_size > 0) {
> 681:         if (EINVAL == pthread_attr_setstacksize(&attr, stack_size)) {

Style-wise it might be more consistent put EINVAL on the RHS of the ==.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4256

Reply via email to