I would recommend to compile in release mode
with debug infos so you can debug the release mode, too.
Probably you know that variables in debug mode are initialized with zero/null automatically, whereas they have random values in release mode.
Cheers
Uwe