In release mode your code is optimized and that can change the flow of your program. For example, if a function is simple and only called once, the compiler can inline the function in release mode.
Debug mode doesn't have these kind of optimization and is designed for debugging your code.