Search code examples
javajava-native-interfacestack

What happens when I attach a native thread with a defined stack size to a JVM which has Xss set?


I am trying to understand what happeneds when a native thread with stack size specified while creating it is attached to a JVM which has -Xss property set. More specifically are these two settings different or if they are same what happens will the native stack size be changed when attached to the JVM?


Solution

  • What happens ...

    Nothing. Your thread continues to exist the way you created it. -Xss is for threads created by the JVM, possibly only for Java threads.

    As a matter of fact in the threading APIs I am familiar with, there is no way to change a thread's stack size after creation.