There are two area inside java virtual machine's memory the heap and the stack . The stack memory is used to store local variables and function call while heap memory is used to store objects in Java The most common cause of StackOverFlowError is too deep or infinite recursion or many local objects / variables creation inside function call in Java. According to the java source documentation, Java throws java.lang.StackOverflowError when a stack overflow occurs because an application recurses too deeply. JVM has a given memory allocation for each stack of each thread, and if an attempt to call a method happens to fill this memory, JVM throws an error. Just like it would do if we try to write at index N of an array of length N. The point to be noted here is that - These are errors not an exceptions. No memory corruption happens due to the error. Stack can not write into the heap space. A StackOverflowError i...
Computer science engineering's subject topics notes, Programming Notes and personal finance stuff








Comments
Post a Comment