I went through so many topics asking about “Why does release build fail and not debug?”, but I’m across a situation where it’s reverse.
Here release build works fine but Debug mode build breaks.
What are possible reasons or situations where this can happen?
Any reply is appreciated.
Thanks in advance.
One of our friend gave some direction towards memory freeing issue..
This is the same thing i’m facing…
When I build in release mode it build successfully, but when I try to build in debug mode it fails/breaks at a point where there is statement for freeing up the allocated memory..
code is like: check if buffer is null, and free it if it’s not null…
if(buffer){
free(buffer)
}
When I keep breakpoint on that line (inside if loop) and check value in debug mode, it appears as “bad pointer”.(0x000000)
but then question remains like why it went inside of if-loop even though buffer has value 0x000000 ?
I don’t know the details about your environment, but some debug environments take extra steps to trigger bugs (e.g. filling
freed memory with invalid data), whereas the release build does not, giving you more chances to get lucky.The problem is that your luck tends to run out when you move up from test data into a real environment….