Error message: Unhandled exception at 0x01A61CD7 in Test.exe: 0xC00000FD: Stack Overflow(Parameters: 0x00000000, 0x03212000)
The call stack window displays like bellow:
Code:
Test.exe!_chkstk() Line 99 Unknown
Test.exe!_AfxDispatchCmdMsg(CCmdTarget * pTarget, unsigned int nID, int nCode, void (void) * pfn, void * pExtra, unsigned int nSig, AFX_CMDHANDLERINFO * pHandlerInfo) Line 81 C++
Test.exe!CCmdTarget::OnCmdMsg(unsigned int nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo) Line 381 C++
Test.exe!CDialog::OnCmdMsg(unsigned int nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo) Line 85 C++
Test.exe!CWnd::OnCommand(unsigned int wParam, long lParam) Line 2785 C++
Test.exe!CWnd::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult) Line 2151 C++
Test.exe!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam) Line 2137 C++
Test.exe!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 290 C++
Test.exe!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 453 C++
In my project, I have lot of fixed size array and its maximum size is 6000.
But didn't receive this error before days.
Problem started, when i'm using recursion function(Using Property sheet & Property Page ) after that only i'm getting this error.
Is increase Stack Reserve Size / Stack Commit Size from Linker, solve this issue?
Increasing the stack will shift the problem, it won't actually solve it unless you have a know absolute bound on stack usage.
But even if you do know or have a bound, there are reasons to avoid excessive stack usage.
Tips:
- Don't use recursion unless you have guarantees about the maximum recursion depth. Then you can at least calculate the needed stack size. But in general any recursive solution that needs more than a few hundred Kb of stack should be converted into another approach. Either another algorithmic solution, or by 'unfolding' the recursion into an iterative approach.
- Avoid large amounts of local data in a function (anything more than a few hundred bytes is "a lot"). Use allocated data to shift memory usage from stack to heap/free store. This is especially true for recursive functions.
As you haven't posted any code, does the recursion function have an exit condition that will be fulfilled that will stop the recursion?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
Problem started, when i'm using recursion function(Using Property sheet & Property Page ) after that only i'm getting this error.
The posted call stack shows no evidence of recursion...
What is a "lot of fixed size array"? How many?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio: FeinWindows - replacement windows manager for Visual Studio, and more...
Increasing the stack will shift the problem, it won't actually solve it unless you have a know absolute bound on stack usage. But even if you do know or have a bound, there are reasons to avoid excessive stack usage.
OK. But I don't know can i come out from this error.
Originally Posted by 2kaud
As you haven't posted any code, does the recursion function have an exit condition that will be fulfilled that will stop the recursion?
I accept. it's hard to answer without seeing any code. But i can't to post my project. But i was created a sample code. but the same error not occurred.
Originally Posted by VladimirF
The posted call stack shows no evidence of recursion...
What is a "lot of fixed size array"? How many?
I don't known exactly is it a stack corruption or recursion error.
Arr[7] - 6 numbers
Arr[24] - 6 numbers
Arr[31] - 6 numbers
Arr[32] - 4 numbers
Arr[60] - 6 numbers
Arr[128] - 8 numbers
Arr[255] - 5 numbers
Arr[256] - 14 numbers
Arr[512] - 6 numbers
Arr[2048] - 3 numbers
Arr[6144] - 1 number
IS the problem solved , if i am using dynamic allocation of array and reallocation of array?
Last edited by saraswathisrinath; May 9th, 2015 at 05:58 AM.
It's possible you have a memory corruption issue which could have been present previously but which is only obvious now due to changed code.
This is where the debugger becomes your friend to identify the issue.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
It's possible you have a memory corruption issue which could have been present previously but which is only obvious now due to changed code.
This is where the debugger becomes your friend to identify the issue.
I will check.
Pls find the attachment. I'm using the same concept.
That is, Main dialog contains a button, when i click that button i called property sheet with one page. that page contain "open button". when i click the open button the recursion starts that is, I opened the same "property sheet with one page" again. but i never take care to close the previous sheet and page. may be its generate the errors.
how can i close the "previous opened property sheet and page" using the "open button in page 1".
... Main dialog contains a button, when i click that button i called property sheet with one page. that page contain "open button". when i click the open button the recursion starts that is, I opened the same "property sheet with one page" again. but i never take care to close the previous sheet and page. may be its generate the errors.
Yes, it may generate the errors because of too many window and other handles would be created.
Originally Posted by saraswathisrinath
how can i close the "previous opened property sheet and page" using the "open button in page 1".
To close a modal property sheet you should call EndDialog from within the sheet class.
To close the modeless sheet - call DestroyWindow or send the WM_CLOSE message to its window from anywhere.
After 25th click of open button, the page was hidden and the sheet only displayed.
When i clicked ALT+TAB control, the pages showed like attached image. kindly find the attachment.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.