c++crashvalgrindmemcheck

Can Valgrind Reports be trusted if the tested program crashes


So I am running Valgrind memcheck on a program, but the program crashes when doing so. Probably because of some timing issues caused by Valgrind making the execution slower.

However I do get somekind of report telling me I am loosing memory at various places. Can this be trusted when the program is crashing? I mean if the program crashes I can assume that there will be memory left unhandled. Can valgrind see this is the case and handle this memory differently?

I do get some reports of "Definitly lost" memory for example. Are they to be trusted?


Solution

  • A 'Definitely Lost' from valgrind (found during execution, by doing a leak search or found at the end of the execution) is very probably a real leak.

    But as suggested, fixing the crash is the first priority.