Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stack overflow at line: 0

Status
Not open for further replies.

crmpicco

Programmer
Nov 29, 2004
66
GB
Error:
Stack overflow at line: 0

what does this mean?

Picco
 
The stack is a region of memory on which local automatic variables are created and function arguments are passed. The implementation allocates a default stack size per process. On modern operating systems, a typical stack has at least 1 megabyte, which is sufficient for most purposes. Under anomalous conditions, the program exceeds its stack limit. This causes a stack overflow. The two most common causes for a stack overflow is an infinite recursion, as in:


int f(){
g();
}
int g() {
f();
}

f() calls g(), which in turn calls f() and so on. Eventually, the stack overflows. Another common cause for stack overflow is an attempt to create a large array on the stack, for example:



int main()
{
int n[10000000]; // array is too large
int j =0; //j's address exceeds the stack's limits, error
}

If your program crashes due to a stack overflow, check for infinite recursion or too large local objects
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top