Game Development Community

Debug versus release build

by Daniel Buckmaster · in Torque Game Engine · 09/21/2010 (6:04 am) · 3 replies

Can anyone tell me precisely what the compiler does differently when building Torque in a debug mode? I've just finished my hierarchical A* pathfinding system, and it works flawlessly in debug mode... but has stopped working at all in a release build! To be fair, I should have been checking release builds continuously throughout development (I thought I did do this semi-regularly... apparently not :P), but it's frustrating to say the least.

About the author

Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!


#1
09/21/2010 (6:33 pm)
In Release mode the compiler performs extra optimization. These can be altered in the projects properties. I find that Release only bugs are usually caused by memory allocation issues. Check to see if you are using strings without preallocating a sufficient buffer size. Sometimes, depending on the compiler, this will only show up in Release mode. That problem has "boned" me more then once. :-)
#2
09/22/2010 (12:52 am)
Quote:I find that Release only bugs are usually caused by memory allocation issues.
Thanks - I figured it'd be something like this. I guess it'll be a matter of figuring out where a compiler might be breaking my fall in terms of memory allocation... or printf debugging :P.

A big part of this system did involve writing two of my own low-level data structures, which I figured would be the cause of any underlying memory-allocation errors... but both of them are testing fine in the release build, so the problem's not there.

Aside from that, I don't think I'm using any strings. The problem seems to be confined to a certain update method which isn't doing its job. The method is basically just linked list modification... hmm.


Also, even more bizarrely, I just did some more tests, and things worked perfectly... once. When I tried getting different paths (or even the same path again), it didn't work.
#3
09/22/2010 (1:41 am)
If I understand correctly, everything works fine in debug mode, but in release mode only works once? I would check to see if your pointers are initialized to NULL when they are defined. In debug mode pointers are automatically assigned a NULL value, but not in release mode. Also make sure that all memory in your data structures are properly deallocated and pointers reinitialized to NULL before reused.

Hope this helps :-)