title: Fixing Memory Leaks
body: <p>I recently discovered that Delphi has a global variable called ReportMemoryLeaksOnShutdown, when set to True will detect  Memory leaks when the Application closes. I found that information from reading some comments on another related question: <a href="https://stackoverflow.com/questions/416046/what-is-the-best-tool-to-detect-memory-leaks-in-delphi/416091#comment10328605_416091">What is the best tool to detect memory leaks in Delphi</a></p>
  
  <p>So from the Project Source I put <code>ReportMemoryLeaksOnShutdown := True;</code></p>
  
  <p>Now when my Application is closed it is picking up a lot of Memory leaks. My immediate thought is to check that created Objects are freed correctly (try..finally..free etc).</p>
  
  <p>I have gone over the code and I cannot see where the leaks could be coming from, and now I need to find them, because if Memory leaks are reported when the Application is exited then that very much means there are Memory leaks at runtime, which will grow in size and is bad!</p>
  
  <p>From the the link above 3rd party tools were recommended such as Eureka Log. Is there a way using just the IDE and debugger to help me find and fix the problem areas?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I managed to get rid of about 6 memory leaks, I discovered it was to do with MDI Childs. The childs are holding some pointer data in listboxes, and when the main Application is closing, it was not freeing the childs correctly, that is now fixed.</p>
  
  <p>I am now left with these 2 errors:</p>
  
  <p><img src="https://i.stack.imgur.com/OXI46.png" alt="enter image description here"></p>
  
  <p>I found this post <a href="http://fgaillard.com/2011/02/when-the-debugger-leaks/" rel="nofollow noreferrer">http://fgaillard.com/2011/02/when-the-debugger-leaks/</a> which may suggest the debugger is at fault with my above error?</p>