title: finding leaks that disappear at exit
body: <p>I'm developing a c++ program. This program seems to leak sometimes. Then it suddenly grows 2/3 times in size and keeps growing up to out of memory. &quot;Run it in valgrind&quot; you would say. I do, but the strange thing is that at exit, it shows leakage of &quot;only&quot; 0.5MB. Not the gigabytes I see using &quot;top&quot; (RSS).</p>
  <p>The program is a program which monitors 10 webcams. They produce a constant fps, a constant resolution, rtsp or mjpeg stream. Nothing of that changes. Time periods are: days(!) of constant memory usage and then suddenly memory usage starts to grow:</p>
  <p><a href="https://i.stack.imgur.com/SwXso.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SwXso.png" alt="example" /></a></p>
  <p>So question now is: any tips for how to figure out these kinds of problems?</p>