PRB: Causes of R6000 "Stack Overflow" ErrorLast reviewed: July 17, 1997Article ID: Q32816 |
6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a | 1.00 1.50 1.51 1.52
MS-DOS | OS/2 | WINDOWSkbprg kbfasttip kbprb The information in this article applies to:
SYMPTOMSAn attempt to run an application fails and the run-time library generates the following message:
R6000 Stack Overflow CAUSEThere are two causes for this error:
RESOLUTIONTo address the first cause above, perform one or more of the following:
Please refer below for more information about the causes of this error, methods to address the problem, and a method to determine which of the causes above is relevant to a given situation.
MORE INFORMATION
Case 1: R6000 Occurs While Application RunningThe stack overflows because the application attempts to push too much data (either function-return addresses or local data) on the stack. Each time a function call is made, the caller pushes the return address on the stack with any parameters. The called function may also allocate stack-based data for its own use. Each process requires stack space. To address the R6000 error, perform one of the following:
Case 2: R6000 Occurs at StartupThe startup code allocates stack space in the DGROUP segment. If DGROUP does not contain enough free space for the stack (by default, 2K), the startup code fails and generates the R6000 error. To address this situation, either reduce the size of the stack or reduce the amount of data stored in DGROUP. To reduce the stack size, compile with the /F <x> option, link with the /STACK:<x> option, or use the EXEMOD utility, as described above. To reduce the amount of data stored in DGROUP, compile the code in a large-data memory model (compact, large, or huge memory model) instead of a small-data memory model (small or medium memory model). If you are already using a large- data memory model, specify the /Gt compiler option switch to move data from DGROUP into far data segments. To use the /Gt option, specify /Gt<x>, where <x> is a decimal number of bytes. Data items larger than <x> bytes are placed into a separate data segment which creates room in DGROUP for the stack.
Determining the Cause of the R6000 ErrorThe CodeView debugger provides an excellent method to determine the cause of the problem. After starting CodeView and specifying your application, execute to the beginning of the main() function by doing one of the following:
|
Additional reference words: 1.00 1.50 6.00 6.00a 6.00ax 7.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |