Crashing in release, not debug.. sigh..

Started by
15 comments, last by okonomiyaki 19 years, 12 months ago
I''ve tried to hours to debug this problem. I have gotten absolutely NOWHERE. I''m using Visual Studio .NET 2003. I compile my program. I run it in debug mode. It works fine. I''m testing a GUI that involves listboxes and textboxes. I then run it in release mode. After 15 seconds the program crashes (like a memory protection error). It happens at various places, usually I can get past the first screen or two, but it always ends up crashing. It works ''perfectly'' fine in debug. I know that debug mode may compile it with safety checks and different machine code... but how in the world would I debug something like this? I really need some suggestions, as this big project is due next Tuesday and I''m really burned out right now Thanks a lot everyone!
Advertisement
do you have a logfile?
you should be ble to debug anything like that without the help of a debugger.
if you can access a console, just throw in some printf or whatever to localize the crash. (if you haven''t already)
I nice version to make it crash is to check pointers for non-null on startup. In debug they''ll be set to 0xcdcdcdcd while in release they can be 0, but can be anything else too.

Debugging release is ugly, usually they best way is to use heavy logging. Add "log i''m here" and "log i''m at pos b" and if it crashes in between draw the two logs closer. Trap the crash

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

I''ve had problems like this before where debug mode runs and release mode doesn''t. I''ve found this to, in my cases, always be the result of uninitialized variables. In debug mode variables and initialized to standard value, in release mode they aren''t initialized and could be anything.
Unitialized variables can give this result.
Also try it without global optimization. If it works, then you probably have errors in function calls.
quote:
do you have a logfile?
you should be ble to debug anything like that without the help of a debugger.
if you can access a console, just throw in some printf or whatever to localize the crash. (if you haven''t already)


I have tried this, somewhat at least. I quit because it varied when it happened, sometimes it happened when typed a letter in a textbox, sometimes it happened when I am searching the listbox for text. I supposed this is only real way to deal with it though, as there might even be more than 1 wrong place.

quote:
Also try it without global optimization. If it works, then you probably have errors in function calls.


Yeah, I tried that, but it still didn''t work. So I''m guessing it''s something with an uninitialized variable somewhere... I usually have a good habit of doing that though

Thanks a lot everyone.
Hey, this article is a true gem: Surviving the Release Version


There''s no place like 127.0.0.1
"We confess our little faults to persuade people that we have no large ones." -Francois de La Rochefoucauld (1613 - 1680). | My blog
Add debug info to your release build and try to debug it.

[How To Ask Questions|STL Programmer''s Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]
Arguing on the internet is like running in the Special Olympics: Even if you win, you're still retarded.[How To Ask Questions|STL Programmer's Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]
You don''t by any chance have multiple threads in your program, do you? Or use any libraries that often create their own internal threads? ''Cause threads can be a great source of unpredictable errors like this. Often caused by not carefully synchronizing code with events, mutexes, semaphores, or whatnot.

Most of the greatest evils that man has inflicted upon man have come through people feeling quite certain about something which, in fact, was false.

-Bertrand Russell, Unpopular Essays, "Ideas That Have Harmed Mankind"
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke
i''ve never had a problem debugging in release mode (MSVS.NET C++ apps). build release -> F5 to run -> debugger breaks out on line with error... do other people not find this to be the case?

-me

This topic is closed to new replies.

Advertisement