I have a function that reads a text file and successfully returns a vector of the small number of lines in the file. I passed this vector to a function to process the lines and it threw an error
Unhandled exception at 0x00267EF9 in Bridge.exe: 0xC00000FD: Stack overflow (parameters: 0x00000000, 0x00A82000). occurred
So, as Ben Voigt pointed out, there was a stack overflow that probably had nothing to do with the function that apparently threw it i.e.
int LinesToCards(std::vector<std::string>& lines) {
int retval = -999;
return retval;
}
This was called from main which had a line needed by a 3rd party DLL
int main()
{
std::string cards[MAXDEALS][DDS_HANDS][DDS_SUITS] ;
int retval = -999;
retval = LinesToCards(lines);
return 0;
}
The #define DDS_HANDS 4 #define DDS_SUITS 4 cannot be changed but the original working
#define MAXDEALS 999
now throws the exception. If I reduce it to
#define MAXDEALS 890
the code runs again. If I up that to
#define MAXDEALS 891
it crashes. Is there some magic number between 16240 and 16256?
You're out of stack space.
The function where the failure happens is not the function that's to blame, and that's why it doesn't happen in your small test program.
One of the functions in the call path to the failing code was very greedy and didn't leave enough stack available for the functions it calls.
Look for both large objects on the stack and also too-deep recursion.
User contributions licensed under CC BY-SA 3.0