Peter Quinn
Peter Quinn

Reputation: 21

Program Output Differs Dramatically Under Valgrind

I have an executable I'm running on a remote linux machine.

When I run the executable normally (./execute arg_one), the program crashes in the middle of a while loop " Error in `./execute': malloc(): memory corruption (fast)"

However, when I run the program under the simplest valgrind (valgrind ./execute arg_one), the program doesn't crash, runs all the way through main, and actually produces the correct output.

Why would this be the case??

Upvotes: 2

Views: 750

Answers (1)

souki
souki

Reputation: 1385

Sometimes it happens that your program crashes, but as valgrind is executing it very slowly it is possible that valgrind runs it to the end, and with the correct output. But it doesn't mean that your program is correct. You should check the errors/contexts shown by valgrind and correct them if you want your program to work.

Upvotes: 2

Related Questions