views:

30

answers:

2

I developed a command-line (non GUI) C program on Linux using QT Creator, which internally uses gdb as its debugger. When I debugged the program on Windows using Visual Studio, it reported that it was writing outside the bounds of allocated memory (although it did not report the violation at the exact time it occurred, so it was still hard to track down). I eventually managed to find a place in the code where a malloc call was allocating too little memory and that solved the problem.

However, it bothers me that this problem was never detected on the Linux side. Are there any switches or something that would enable this detection feature on Linux?

+2  A: 

There are many in-code memory validators that work both for Windows and Linux. Check Wikipedia for their list. However, most Linux users use Valgrind as the ultimate tool for memory debugging.

dark_charlie
+2  A: 

Electric Fence

Ignacio Vazquez-Abrams