• Advertisement
Sign in to follow this  

Game gets corrupted in release mode??

This topic is 3504 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone. While building my game engine, I have run into a very strange problem. I am trying to simply output the FPS on the screen for testing, and it works perfect in a debug build. However, when I build the exact same code in release mode, the text appears corrupted. Below are two screenshots that I have taken of the incident. If anybody has any ideas why this is happening, it would be very much appreciated. The configuration is nearly identical between the debug and release. I am using D3DXFONT::DrawTextA to draw this text. Debug: http://i32.photobucket.com/albums/d34/rsf1000/Debug.jpg Release: http://i32.photobucket.com/albums/d34/rsf1000/Release.jpg

Share this post


Link to post
Share on other sites
Advertisement
There are lots of possible causes, but the most likely is that you have uninitialized variables. In debug mode, variables are initialized to 0, and in release mode, they just have the value of whatever was in that part of memory before.

So check that you're initializing variables, especially anything that you're using as an argument to DrawTextA.

Share this post


Link to post
Share on other sites
I would take a look in the font drawing routine, specifically, around the spacing of the characters. The release one looks like all the letters are smushed together.

Edit: Well, just re-read your post. Your using D3DXFONT, so uh, nevermind.

Share this post


Link to post
Share on other sites
Okay, I found that the problem was I was settings the width member of D3DXFONT_DESC to an invalid value....Thank you guys for your help.

Share this post


Link to post
Share on other sites
Is that in release by anychance? you pretty much can't use the debugger when in release because the compiler will try to optimize and reorganize your code so the debugger is just like "huh?"

p.s. hyperlink.. let me show you.

<.a href="imgURLHere">zomg img url here for good measure<./a>

(without the periods of course)

Share this post


Link to post
Share on other sites
Quote:
Original post by bzroom
Is that in release by anychance? you pretty much can't use the debugger when in release because the compiler will try to optimize and reorganize your code so the debugger is just like "huh?"

p.s. hyperlink.. let me show you.

<.a href="imgURLHere">zomg img url here for good measure<./a>

(without the periods of course)


Yeah, the debugger wasn't working in release mode, and I didn't know that this forum allows HTML. Thanks

Share this post


Link to post
Share on other sites
90% of the time this happens to us it is one of two things:

1) Uninitialized values... fairly self explanatory, check for uninitialized values, and make sure you get into the habit of initializing your variables. If this is a common occurance, you may not be efficiently creating variables.

2) You are corrupting the heap somewhere. Usually invalid pointers or stepping out of bounds on an array, often this can happen because of problem number 1 too. A trick I learned is to enable a feature in Windows called "Global Page Heap". If you check the MS website for it, there is a simple debugging toolset you can download, and a command to give on command prompt. Basically this makes windows check all heap allocations and access in your game. If you are not using any special memory management techniques (such as memory pooling) this should work well.

Also remember that can can make a release build, which behaves fully like a release build but does also include debugging symboles, so that when you experience the crash at least you can do some JIT debugging and see where it happened. Just turn debugging symbol output on in the release build properties.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement