I am working on an application/GUI created with Win32/ATL .
So there is UI field( text field) which works fine as designed in debug build. With release build it gets malformed and it looks like the width of text field is infinite.
It works fine in debug build but creating issues in release build.
So my question how same code can work in debug build and not working in release build.
Is there any chance that it could be releated to optimization settings in release builds ?
In release build we have optimization settings set to Minimum Size, Favour small code.
Also when I try to debug release build ,it again works fine. Does debugging in release build removes optimization?
I want to reproduce the issue while debugging in release build or may be if possible in debug build.
Any suggestions?
VC++ fills its runtime-memory in debug mode with special values. It does not ensure any fixed or zero-initialization though. Read this SO thread for details. Uninitialized Memory Blocks. These values may not crash the application every time.
I have run into similar situations some times. One common example is that accessing past the array boundaries is an error. Many a time this was not evident in debug mode but crashed in release builds. In general, the runtime is leniant in debug modes and provides more cover to programmer errors.
As others have pointed out, there is definitely some problem with the code; most probably uninitialized variables.