What is the difference between -Xss and -XX:ThreadStackSize?

前端 未结 5 2164
我寻月下人不归
我寻月下人不归 2021-02-13 16:00

I just want to control the stack size for all of my threads in a Java (groovy) application. For the Hotspot Oracle VM, I know that there are two parameters doing that (-Xss and

5条回答
  •  旧时难觅i
    2021-02-13 16:49

    UPDATED 2019 for Java SE 8

    Current Oracle Java SE 8 docs suggest that -Xss and -XX:ThreadStackSize=size are equivalent. See
    https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html


    For -Xss:

    -Xsssize  
    
       Sets the thread stack size (in bytes). Append the 
       letter k or K to indicate KB, m or M to indicate MB, g or G to 
       indicate GB. The default value depends on the platform:
    
    Linux/ARM (32-bit): 320 KB
    
    Linux/i386 (32-bit): 320 KB
    
    Linux/x64 (64-bit): 1024 KB
    
    OS X (64-bit): 1024 KB
    
    Oracle Solaris/i386 (32-bit): 320 KB
    
    Oracle Solaris/x64 (64-bit): 1024 KB
    
    The following examples set the thread stack size to 1024 KB in different units:
    
    -Xss1m
    -Xss1024k
    -Xss1048576 
    
    This option is equivalent to -XX:ThreadStackSize.
    

    For -XX:ThreadStackSize=size

    -XX:ThreadStackSize=size 
    
      Sets the thread stack size (in bytes). Append the 
      letter k or K to indicate kilobytes, m or M to indicate 
      megabytes, g or G to indicate gigabytes. The default 
      value depends on the platform:
    
    Linux/ARM (32-bit): 320 KB
    
    Linux/i386 (32-bit): 320 KB
    
    Linux/x64 (64-bit): 1024 KB
    
    OS X (64-bit): 1024 KB
    
    Oracle Solaris/i386 (32-bit): 320 KB
    
    Oracle Solaris/x64 (64-bit): 1024 KB
    
    The following examples show how to set the thread stack size to 1024 KB in different units:
    
    -XX:ThreadStackSize=1m
    -XX:ThreadStackSize=1024k
    -XX:ThreadStackSize=1048576 
    
    This option is equivalent to -Xss.
    

提交回复
热议问题