0

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?

jimmy
  • 1,981
  • 3
  • 19
  • 28
  • I wouldn't trust it. Surely fixing the crash is more urgent than dealing with memory leakage anyway (assuming the two aren't directly related). – Mats Petersson Nov 12 '14 at 09:44
  • Probably more interesting than the leak report are the spots where valgrind reports illegal or uninitialized memory accesses (read/write) that may be a reason for your crash. – Johannes S. Nov 12 '14 at 09:54
  • The crash is of course important, but since it is only crashing when running Valgrind it is not prioritized. – jimmy Nov 12 '14 at 14:02

1 Answers1

1

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.

phd
  • 3,669
  • 1
  • 11
  • 12