Debug = fine, Release = crash[SOLVED]

Started by
22 comments, last by Promit 15 years, 8 months ago
Hello all, I'm wondering what would cause a crash in the release version of my program but not in the debug version? Its really weird when it crashes tho. DirectX 9 Debug runtimes report no errors or memory leaks, return errors with the release version, but no memory leaks. It usually crashes either after rendering one frame or right after it brings up the window which is when I initialize DirectX. The wierd part is before I create the window I write text to the logger, which is not getting written(I call flush after each write) to the text file. Any ideas on what it could be? See Last Post [Edited by - Eeyore on July 26, 2008 6:40:18 PM]
Advertisement
Which compiler are you using?

You can try going into the compiler settings (Project properties in MSVC) and changing features such as Optimisation and run-time checking to be the same as debug (do one at a time) until you find a combination of settings that doesn't crash. This might give you a hint as to what is causing it.
I remember that often when a debug works and a release doesn't the reason is an uninitialized variable or access to uninitialized memory: IIRC in debug memory is initialized to a default value, but in release memory and variable content is undefined until explicitly assigned, so this may cause the crash... Try to look at variable and memory access while debugging to see if you access a memory location with the defaul value (I don't remember wich is it though)...
Quote:Original post by Eeyore
DirectX 9 Debug runtimes report no errors or memory leaks, return errors with the release version, but no memory leaks.
D3D is giving you errors in release mode? What errors? I's make sure they're fixed first.
Quote:Original post by cignox1
I remember that often when a debug works and a release doesn't the reason is an uninitialized variable or access to uninitialized memory: IIRC in debug memory is initialized to a default value, but in release memory and variable content is undefined until explicitly assigned, so this may cause the crash... Try to look at variable and memory access while debugging to see if you access a memory location with the defaul value (I don't remember wich is it though)...

Exactly what I was thinking.

I would step through and make sure that everything is getting initialized as expected. I have had similar things happen in the past and it has always turned out that I have made a silly mistake somewhere.
In debug generally variables are spaced out in order to fit additional debug information in memory. So memory corruption can sometimes go un-noticed when running a debug variant. So pretty much check for any stack/heap corruption that might be occuring in your code, because there's likely some memory over/underrun(s) happening somewhere.
Quote:Original post by Hodgman
Which compiler are you using?

You can try going into the compiler settings (Project properties in MSVC) and changing features such as Optimisation and run-time checking to be the same as debug (do one at a time) until you find a combination of settings that doesn't crash. This might give you a hint as to what is causing it.


I'm using Visual C# 08. The only option I saw was Optimization.

I looked through my code and saw no variables that aren't used or aren't initialized. Usually when a variable isn't set properly it'll throw an exception that the variable is null.

The DirectX error, I have no idea what it is. DebugView simplys dumps millions of lines of the same thing over and over with absolutely no useful information at all.

[2616] Direct3D9: (ERROR) :    [0] : Address 035DE4CB[2616] [2616] Direct3D9: (ERROR) :    [1] : Address 035DE59B[2616] [2616] Direct3D9: (ERROR) :    [2] : Address 035DE440[2616] [2616] Direct3D9: (ERROR) :    [3] : Address 035D2DB4[2616] [2616] Direct3D9: (ERROR) :    [4] : Address 4FDFAF2E[2616] [2616] Direct3D9: (ERROR) :    [5] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [6] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [7] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [8] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [9] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [10] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [11] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [12] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [13] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [14] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [15] : Address 00000000...
[2616] Direct3D9: (ERROR) :    [0] : Address 035DE4CB[2616] [2616] Direct3D9: (ERROR) :    [1] : Address 035DE59B[2616] [2616] Direct3D9: (ERROR) :    [2] : Address 035DE440[2616] [2616] Direct3D9: (ERROR) :    [3] : Address 035D2DB4[2616] [2616] Direct3D9: (ERROR) :    [4] : Address 4FDFAF2E[2616] [2616] Direct3D9: (ERROR) :    [5] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [6] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [7] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [8] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [9] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [10] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [11] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [12] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [13] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [14] : Address 00000000[2616] [2616] Direct3D9: (ERROR) :    [15] : Address 00000000...


Thats what it looks like when a DX-COM object doesn't have its ->Release() method called, probably because you are crashing before your deconstructers are called.
Ok I got the logger working. I placed various writes throughout the game loop to try and pinpoint where it is. My findings are quite sparatic. The point at which it crashes seems to differ each time. Some times it crashes before it gets to the game loop, sometimes its able to render a good number of frames before crashing, and other times it crashes after one frame. Because its so random, I can't think of any good reason why its happening. Possibly something wrong with my computer? Can't be because I've played a game for an hour or two hours without issues.
bump *whistles*

If it helps any...I'm using level 4 warnings...VC# reports no warnings or errors.

This topic is closed to new replies.

Advertisement