Stack Overflow (Stack Overflow)

Call to call a function describing the relationship between the stack (Call Stack). It consists of a plurality of frames stack (Stack Frame), each stack frame corresponds to a function is not finished running. The stack frame holds the function's return address and local variables, and therefore can not be finished after find the correct return address is still ensured since the local variables between different functions unrelated - different functions corresponding to different stack frame.

 

Executable file, the text segment (Text Segment) for storing instructions, a data section (Data Segment) for storing global variables initialized, the BSS segment (BSS Segment) for the space required to store the global variable unassigned .

 

Call stack is not stored in the executable file, but created at runtime, call the segment called stack where the stack segment (Stack Segment). And other sections, like the stack segment also has its own size, can not be cross-border access, otherwise mistakes (Segmentation Fault) will appear.

 

Stack Overflow (Stack Overflow): each recursive call requires to increase the call stack in a stack frame, over time it crossed the line. This is called a stack overflow.

At runtime, the program will create a dynamic stack segment, which kept the call stack, and therefore holds Investigates function calls and local variables.

Guess you like

Origin www.cnblogs.com/code-fun/p/12507036.html