Java Error Stack Overflow Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have how to solve stack overflow error in java Meta Discuss the workings and policies of this site About Us how to resolve stack overflow error in java Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with
Java Increase Stack Size
us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just
Java Stackoverflow
like you, helping each other. Join them; it only takes a minute: Sign up What actually causes a Stack Overflow error? [duplicate] up vote 204 down vote favorite 37 This question already has an answer here: What is a StackOverflowError? 11 answers I've looked everywhere and can't find a solid answer. According to the documentation, Java throws fix stack overflow error a java.lang.StackOverflowError error under the following circumstance: Thrown when a stack overflow occurs because an application recurses too deeply. But this raises two questions: Aren't there other ways for a stack overflow to occur, not only through recursion? Does the StackOverflowError happen before the JVM actually overflows the stack or after? To elaborate on the second question: When Java throws the StackOverflowError, can you safely assume that the stack did not write into the heap? If you shrink the size of the stack or heap in a try/catch on a function that throws a stack overflow, can you continue working? Is this documented anywhere? Answers I am not looking for: A StackOverflow happens because of bad recursion. A StackOverflow happens when the heap meets the stack. java jvm stack-overflow share|improve this question edited Mar 4 '14 at 21:54 hichris123 6,551113257 asked Mar 4 '14 at 20:46 retrohacker 1,66231025 marked as duplicate by Jarrod Robersonjava Users with the java badge can single-handedly close java questions as duplicates
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about
Stackoverflowerror Java Recursion
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask stack overflow in java with example Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. stackoverflow java tutorial Join them; it only takes a minute: Sign up What is a StackOverflowError? up vote 221 down vote favorite 74 What is a StackOverflowError, what causes it, and how should I deal with them? java exception-handling stack-overflow share|improve this http://stackoverflow.com/questions/22182669/what-actually-causes-a-stack-overflow-error question edited Jun 19 '15 at 4:55 asked Oct 18 '08 at 8:13 Ziggy 7,384165475 add a comment| 11 Answers 11 active oldest votes up vote 230 down vote accepted Parameters and local variables are allocated on the stack (with reference types the object lives on the heap and a variable references that object). The stack typically lives at the upper end of your address space and as it is used up it heads towards the bottom of the http://stackoverflow.com/questions/214741/what-is-a-stackoverflowerror address space (i.e. towards zero). Your process also has a heap, which lives at the bottom end of your process. As you allocate memory this heap can grow towards the upper end of your address space. As you can see, there is the potential for the heap to "collide" with the stack (a bit like tectonic plates!!!). The common cause for a stack overflow is a bad recursive call. Typically this is caused when your recursive functions doesn't have the correct termination condition, so it ends up calling itself forever. However, with GUI programming it's possible to generate indirect recursion. For example, your app may be handling paint messages and whilst processing them it may call a function that causes the system to send another paint message. Here you've not explicitly called yourself, but the OS/VM has done it for you. To deal with them you'll need to examine your code. If you've got functions that call themselves then check that you've got a terminating condition. If you have then check than when calling the function you have at least modified one of the arguments, otherwise there'll be no visible change for the recursively called function and the terminating condition is useless. If you've got no obvious recursive functions then check to see if you're calling any library functions that indirectly will cause your function to be called (like the implicit case a
Method java.lang Class StackOverflowError java.lang.Object java.lang.Throwable java.lang.Error java.lang.VirtualMachineError java.lang.StackOverflowError All stack overflow Implemented Interfaces: Serializable public class StackOverflowError extends VirtualMachineError Thrown when a stack overflow occurs because an application recurses too deeply. Since: stack overflow error JDK1.0 See Also:Serialized Form Constructor Summary Constructors Constructor and Description StackOverflowError() Constructs a StackOverflowError with no detail message. StackOverflowError(Strings) Constructs a StackOverflowError with the specified detail message. Method Summary Methods inherited from classjava.lang.Throwable addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace,