I’ve been writing my own graphics engine for quite some time now, and have reached th epoint where adding a lot of objects causes the framerate to drop to an unacceptable level when using executables compiled in Debug mode. Switching to the Release mode has given me a 10fold performance increase, but has caused strange run time errors that I can’t account for. For instance, some objects won’t render, some calculations are off, etc. Does anyone know of any common compiler options that can be set to alleviate some of these problems?
I use .net 2003 and haven’t had any unexpected issues. Verify that you are initializing all variables that require it. Also, verify that you don’t have wild pointers - pointers pointing into the wrong memory space (though in debug mode it would likely warn you or fail nicely). Also, verify you are freeing up dynamically allocated memory. In debug mode uninitialized variables are given a default value including uninitialized pointers and manages memory freeing up all dynamically allocated memory after the program exits. There are others aspects of debug mode which help to maintain stability but for release it is up to you to verify the integrity of your variables, memory, etc.
Surviving the Release Version is one of the most complete sources of information on release build problems.
PS: Most of the resources, you allocated (memory, handles etc.) in your process will be released by the operating system, when the process ends. It does not depend on the type of build (ie debug vs release), although most of the time this is not an excuse not to clean them up before exiting.
Originally posted by M. Wassmer:
Switching to the Release mode has given me a 10fold performance increase, but has caused strange run time errors that I can’t account for. For instance, some objects won’t render, some calculations are off, etc.
Also, if your floating point operations are going off, try enabling improve floating point consistency with the /Op flag.
Thanks for the replies. I’ve fixed the problem. The trouble was an uninitialized variable. I had initialized it in a constructor, but then Visual Studio crashed and hadn’t autosaved.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.