Stack around the variable 'theAnalysis' was corrupted

For developers writing C++, Fortran, Java, code who have questions or comments to make.

Moderators: silvia, selimgunay, Moderators

Post Reply
huangc
Posts: 6
Joined: Mon Jul 27, 2009 4:42 pm
Location: China

Stack around the variable 'theAnalysis' was corrupted

Post by huangc »

Hi,

I try to use QuickMain example code in a method of my own class.
because I don't have exit(0) added, The debug message is:

"Stack around the variable 'theAnalysis' was corrupted."

Can anybody tell me how to solve it?
Thanks
burnningcat
Posts: 50
Joined: Mon Jun 18, 2007 1:10 am
Location: ROMA

Post by burnningcat »

My friend, I meet the same problem with you, the error will disappear if you use the "Release" mode.

But the following porblme is that you can not debug! I really hope that somebody tell me how to solve this problem.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

i have just built and executed the code using what is available in cvs. it works.

there was a minor change, but that should have stopped the compiler from building the .exe, which is not the problem you two have described.

can you try building using the source code available in cvs to see if the problem you describe still exists.
huangc
Posts: 6
Joined: Mon Jul 27, 2009 4:42 pm
Location: China

Post by huangc »

HI, fmk.

I update the code using CVS and rebuild the quickMain, it works.
But if I remove the "exit(0)" in the end of the main function, the problem appeares again.

Run-Time Check Failure #2 - Stack around the variable 'theAnalysis' was corruupted.
burnningcat
Posts: 50
Joined: Mon Jun 18, 2007 1:10 am
Location: ROMA

Post by burnningcat »

Dear friend, the problem seems to be caused by the line "Return" in the end. Because in the "Return", the program has to delete the Vectors and the Matrix..But I dont konw why this "delete" of the Matrix will cause the Analysis to Callapse....I really hope someone give us his kind help.
reindevries
Posts: 1
Joined: Sun Jul 14, 2013 9:41 am
Location: None

Re: Stack around the variable 'theAnalysis' was corrupted

Post by reindevries »

Ehm sorry for bringing this up again, but I get exactly the same error. And it is definitely an error, calling the exit function is just plain wrong as it skips the destructors of your objects. For that matter, you should let the stack nicely unwind itself, just return 0 at the end of the main function. Of course the release version makes the error message go away since the stack is not checked anymore, this doesn't mean that the error is gone...

I caught this error running \EXAMPLES\Example1\main.cpp. Also, there are memory leaks.
Post Reply