Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum depth of the java call stack?

Tags:

java

How deep do I need to go into the call stack before I get a StackOverflowError? Is the answer platform dependent?

like image 682
ripper234 Avatar asked Jan 19 '11 10:01

ripper234


People also ask

What would be the maximum depth of call stack?

The call f(5) creates a call stack with a maximum depth of 5. It is possible that the call f(10) would create a deeper call stack.

What is stack depth in Java?

The Java stack size is the size limit of each Java thread in the Java Virtual Machine (JVM) that runs the monitoring Model Repository Service. The default value is 512K. You can increase this property to make more memory available to monitoring Model Repository Service processes.

What is call stack in Java?

The call stack is what a program uses to keep track of method calls. The call stack is made up of stack frames—one for each method call. For instance, say we called a method that rolled two dice and printed the sum.

What is the recursive stack size?

Java does not effectively handle the stack space for recursive type functions. The default value for the stack size in the JVM is 1024K. Therefore, you must increase the stack size for the JVM to 4M depending on the recursive logic defined in the workflow.


1 Answers

It depends on the amount of virtual memory allocated to the stack.

http://www.odi.ch/weblog/posting.php?posting=411

You can tune this with the -Xss VM parameter or with the Thread(ThreadGroup, Runnable, String, long) constructor.

like image 163
finnw Avatar answered Sep 20 '22 14:09

finnw