hello, got a quick question regarding stack overflow (I honestly don't know if this is more suited for a wxWidgets forum, once you see what I mean, but I figured I'd try here first). I was tweaking my linked list class and testing it in a testing harness program I wrote for it (performance, making sure functions work, etc) when I now get stack overflow errors when I start the debugger (VS2008 PRO). Here's the message:
Unhandled exception at 0x772e0e5a in Tester.exe: 0xC00000FD: Stack overflow.
I traced it back to the constructor of the window frame:
bool MyApp::OnInit() //initializer
{
MyFrame *mainFrame = new MyFrame(wxT("Test Harness"), wxSize(700, 600) ); //breakpoint 1
mainFrame->Show(true);
return true;
}
//...
MyFrame::MyFrame(const wxString& title, const wxSize& size) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, size)
{
CreateStatusBar(); //breakpoint 2
SetStatusText(wxT("Performance Data"));
//panels and controls
}
//...
//malloc.c
//...
#ifdef _WIN64
return HeapAlloc(_crtheap, 0, size ? size : 1);
#else /* _WIN64 */
if (__active_heap == __SYSTEM_HEAP) {
return HeapAlloc(_crtheap, 0, size ? size : 1); //VS said this line was the problem
} else
if ( __active_heap == __V6_HEAP ) {
if (pvReturn = V6_HeapAlloc(size)) {
return pvReturn;
}
}
//...
I would start at breakpoint 1 but never hit breakpoint 2, which means it must be failing in the constructor (memory allocation from the inherited constructor).
It started failing after I added another operator function of my linked list (++ so I wouldn't have to keep saying 'iterator = iterator->NextCell()' ), even though I thought it was odd I removed the operator and reverted all the uses of it back to the original. Surprise, surprise that I'm still getting the stack overflow issue.
Things I've tried:
1. Restarting VS
2. Restarting my computer
I made sure I wasn't out of memory, I have 3 gigs and my performance monitor said I was using just under 2, so unless my program needed over a gig to build a relatively simple gui, I think it's something else. You guys can advise if this is the wrong forum, but any suggestions would be appreciated.
~J