Using XSS memory parameter to control stackoverflowerror
buy generic viagra no prescription by · June 2, 2017
Each thread in a Java application has its own stack. The stack is used to hold return addresses, function/method call arguments, etc. So if a thread tends to process large structures via recursive algorithms, it may need a large stack for all those return addresses and such. With the Sun JVM, you can set that size via that parameter.
The thread stack is used to push stacks frames in nested method calls. If the nesting is so deep that the thread runs out of space, the thread dies with a StackOverflowError.
The default thread stack size varies with JVM, OS and environment variables. A typical value is 512k.
This is the sample code which will deliberately makes recursive calls so that we can simulate stackoverflow error. For default 1M XSS memory, it runs approx 8k times before running out of space. For 512k, it runs 4k time and for 2M XSS memory, it runs 19k times