What is Stack overflow at line 156

Asked By 30 points N/A Posted on -
qa-featured

What is stack overflow and how do I fix it?

Any suggestions on what to do?

Thanks

SHARE
Best Answer by Sharath Reddy
Answered By 0 points N/A #148490

What is Stack overflow at line 156

qa-featured

If a program attempts to utilize some specific space at line 156 that is not available on call stack, it is call buffer overflow or stack overflow at line 156. It happens only when too much memory is used on the call stack. The general cause of stack overflow is extremely deep or infinite recursion.

Call stack does not depend on only one factor but it lies into the programming language, machine architecture, multi-threading, and amount of available memory factors.

To fix your problem you have to confirm if memory is used excessive or not, is the programming language, machine architecture, multi-threading are all right. To confirm these factors you will certainly get your answer.

Best Answer
Best Answer
Answered By 590495 points N/A #148491

What is Stack overflow at line 156

qa-featured

I always encounter this error during my student years which most of the time starts whenever I open an executable.

The stack overflow problem is related to the amount of memory used in the call stack.

A call stack contains a very limited amount of memory and it is set when the program starts. Now, when that call stack already uses too much memory, as the program runs, that is beyond the available space in the call stack which is a buffer overflow, the stack is said to overflow then the program crashes.

This error is called a stack overflow.

The usual cause of a stack overflow is extremely deep recursion. Below is an example of a deep or infinite recursion.

int foo() {
     return foo();
}

A recursive function that usually causes stack overflow can be fixed by making it into a loop and saving the function arguments in a stack like what is described in the images below. The recursive function on the first image:

Can be transformed into a loop on the second image:

Related Questions