Exe Game.Debug

BlitzMax Forums/BlitzMax Beginners Area/Exe Game.Debug

Yue(Posted 2016) [#1]
That involves compiling an executable as debug and because it occupies this executable leave larger.

Sample. name.debug.exe

This has benefits, disadvantages?


Henri(Posted 2016) [#2]
Hi Yue,

when you are compiling in debug mode the executable is larger due to all the debug information it contains. Also program will run slightly slower (although might not be visually noticeable) and the variable scope is longer meaning variable might stay longer accessable and garbage collection might not kick in so aggressively because of the nature of debugging process.

Conclusion:

If you are releasing your work to public then always use release mode. Debugging mode is only for developing as it is designed to catch errors.


-Henri


FireballStarfish(Posted 2016) [#3]
Depending on your program, a debug build can run not just slightly, but very much slower. So you should aim for compiling your program in release mode once it's done.
An important thing to note however: due to the certain error checks being performed only in debug mode, you should never rely on the Assert command or on catching builtin exceptions for normal program execution. Otherwise, the behaviour of your program might vary betwen builds. For example, don't do anything like this
Local a:Int[] = [1, 2, 3, 4, 5]
Try
	For Local i:Int = 0 To 100	' too lazy to check a.Length
		Print a[i]
	Next
Catch e:TArrayBoundsException
	Print "end of array reached"
End Try
because the TArrayBoundsException will not actually occur in release build. Custom exceptions that you created by using the Throw command are no problem though.