What is a StackOverflow Error

0 votes
What is a StackOverflow Error? How does it occur? How should I work-out with it?
May 21, 2018 in Java by sharth
• 3,310 points
36 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
Parameters and local variables are allocated on the stack (with reference types the object lives on the heap and a variable references that is 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 address space (i.e. towards zero)

Your process also has a heap. As you allocate memory, this heap can grow towards the upper end of your address space.              

The common cause for a stack overflow is a bad recursive call. Typically, this is caused when your recursive functions do not have the correct termination condition, so it ends up calling itself forever. However, with GUI programming, it is possible to generate indirect recursion. For example, your app may be handling paint messages, and, while processing them, it calls a function that causes the system to send another paint message. Here you have explicitly called yourself, but the OS has done it.

To deal with them you'll need to examine your code. If you have got functions that call themselves then check that you've got a terminating condition. If you have then check that after calling the function you have the modified arguments, otherwise there'll be no visible change for the recursively called function.
answered May 21, 2018 by parth295
• 4,590 points

Related Questions In Java

0 votes
1 answer

what is the best way to convert an ArrayList to a String

String lString = String.join(", ", list); In case ...READ MORE

answered Apr 26, 2018 in Java by developer_1
• 3,220 points
31 views
0 votes
1 answer

What is the simplest way to read JSON from a URL in java

Read json from url use url.openStream() and read contents ...READ MORE

answered Jun 13, 2018 in Java by samarth295
• 2,190 points
87 views
0 votes
1 answer

What is an efficient way to implement a singleton pattern in Java?

Use an enum: public enum Foo { ...READ MORE

answered Jul 6, 2018 in Java by Akrati
• 3,150 points
55 views
0 votes
1 answer

What is the easiest way to iterate through the characters of a string in Java?

The below code seems the easiest to ...READ MORE

answered Jul 13, 2018 in Java by scarlett
• 1,280 points
28 views
0 votes
1 answer

Non-static variable cannot be referenced from a static context. Explain?

Static fields and methods are connected to ...READ MORE

answered May 21, 2018 in Java by parth295
• 4,590 points
3,157 views
+8 votes
11 answers

Unable to resolve this error: "javac is not recognized as an internal or external command"

Check your javac path on Windows using Windows Explorer C:\Program Files\Java\jdk1.7.0_02\bin and ...READ MORE

answered May 23, 2018 in Java by Rishabh
• 3,520 points
18,864 views
0 votes
2 answers

Connection reset : java.net.SocketException

You should check whether the client program is ...READ MORE

answered Sep 6, 2018 in Java by Sushmita
• 6,820 points
788 views
0 votes
2 answers

“Cannot find symbol” compilation error

The "Cannot find symbol" errors generally occur when you ...READ MORE

answered Apr 3 in Java by patricblues
• 140 points
2,421 views
0 votes
2 answers

What is the difference between = and equals()?

The equals() method compares the "value" inside String instances ...READ MORE

answered Aug 13, 2018 in Java by Daisy
• 8,020 points
25 views
0 votes
2 answers

Is there a destructor in Java?

try (BufferedReader br = new BufferedReader(new FileReader(path))) ...READ MORE

answered Sep 4, 2018 in Java by Sushmita
• 6,820 points
196 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.