jcm
jcm

Reputation: 5659

What scenarios could create the need to increase the stack size of the Java JVM?

I only learnt today that it is possible to set the size of the stack memory in the Java JVM. Now what I'm wondering is when would you ever have the need to do this?

I can't think of any concrete examples where this might be necessary. I've only gotten StackOverFlowExceptions when I've stuffed something up in my code, like an infinite recursion or something.

Upvotes: 2

Views: 107

Answers (1)

NPE
NPE

Reputation: 500367

Setting the stack size does not necessarily mean increasing it. ;-)

You might need to increase the stack size if you have very deep recursion.

You might need to decrease the stack size if you are running on a 32-bit JVM and have lots of threads. Each thread has a separate stack that takes up address space, and address space is a scarce resource.

Upvotes: 3

Related Questions