Question

I have a very large application 20,000+ lines written in C compiled on a MinGW compiler. The application has a memory leak when it is compiled in release mode, but does not appear to leak in debug mode. I have created a running counter to ensure that I have as many free() calls as I have malloc() calloc() calls.

Obviously my codebase is too large to post here, so my question is what kind of differences occur when compiling between debug and release that are capable of causing a memory leak issue that I might want to investigate into?

Many Thanks!

No correct solution

OTHER TIPS

If you are using different options when compiling for debug rather than compiling for production, the memory structure of your program may be slightly different (in particular, different optimization settings affect this). This shouldn't matter for well-formed code, but if you're reading from or writing to an invalid pointer or beyond the end of an array, what variable you're overwriting may change, turning a harmless error harmful, or vice versa.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top