title: Running time in C program on gcc - with and without valgrind
body: <p>I have written a program on C and now I am running it on gcc, with valgrind (the program that detects memory loses).</p>
  
  <p>The thing is, when I run it without valgrind, it works <strong>much</strong> faster than with valgrind. I have tried it on several inputs and the result is that when the input is pretty high, is even can not end with valgrind, but without it it takes several seconds.</p>
  
  <p>My program has a lot of calls to malloc in it, Can it be related?</p>
  
  <p>Unfortunately I can not post my code, because it is a part of an assignment, and I have to keep it discrete. This assignment will probably be checked with valgrind, so I have to solve it.</p>
  
  <p>A general answer and possible solutions could help very much.</p>
  
  <p>Thanks</p>