You can debug a release build.
To enable debugging of a release build, change the following release build options
These selections correspond to the /Od and /Zi options, which turn off optimizations and place debug information in the build.
After doing this, rebuild and test your program. If at this point the program works fine, then it is still possible that you have a memory overwrite, but it is also possible that the optimizations are causing problems on a particular piece of code. To isolate that code, see Optimization Problem.
The purpose of turning off optimizations is to help you in debugging the application. With optimizations on, the debugger won't necessarily be able to show you the correct source code and debug information.
You can now debug your release build application. Finding the problem is now a matter of stepping through the code (or of using Just-In-Time debugging) until you find where the failure occurs, and then determine the incorrect parameters or code.