title: Redirect results from ReportMemoryLeaksOnShutdown to a log file
body: <p>I want to add memory leak detection to our automated Unit tests. ReportMemoryLeaksOnShutdown will detect any memory leaks. The big problem is that it prints the results to a modal dialog box, which has to be closed manually by the user. This does not work in an automated Unit test running on a build server.</p>
  
  <p>Is there any way to redirect the output from ReportMemoryLeaksOnShutdown to somewhere else? For example, print the information to a file?</p>
  
  <p>The doco says:</p>
  
  <blockquote>
    <p>the Memory Manager will scan the
    memory pool when it shuts down and
    report all unregistered memory leaks
    <em>in a message dialog</em>.</p>
  </blockquote>
  
  <p>I am using Delphi 2010</p>