title: Monitor Memory Use in Delphi App
body: <p>I inherited a very large subsystem from a programmer that left the company and the first order of business is to stop the process from running out of memory.</p>
  
  <p>Basically, it is a loop through a dataset, within which we create and destroy a data module that goes off and does lots of work. As long as this data module is created, you can see memory use climbing all the time in Task Manager until it blows up. I seem to recall from an article I read years ago that one shouldn't fully trust what is reported by Task Manager, as the values are estimates and not real-time. So I am looking for alternatives.</p>
  
  <p>Here's what I have tried:</p>
  
  <ol>
  <li>ReportMemoryLeaksOnShutdown := True in my main project file, but it returns nothing. So either it doesn't monitor memory leaked in packages that are loaded dynamically, or the memory gets freed before the app closes.</li>
  <li>AQTime. This is supposed to be a very <strong>wow</strong> product, but I find it completely underwhelming. If I use the allocation profiler, I end up with hundreds of lines containing nothing useful. Just a memory address, size and something along the lines of "VCL standard allocation." It supposedly breaks down the information by routine, but I just get a flat list with no routine info whatsoever. So I don't think it works.</li>
  </ol>
  
  <p>Is there another tool that can help me trace where this memory is allocated and not freed? I've been commenting out little bits of functionality all over the place to see where the problem goes away and checked that everything that is explicitly allocated gets freed, but I still have a leak and it can be quite a frustrating process.</p>