Reporting memory leaks on shutdown with a console application
<p>I've created a console application and set ReportMemoryLeaksOnShutdown := True.</p>

<p>I've created a TStringList but did not free it. </p>

<p>When the program finishes executing, I see the memory leak for a brief second but then the console closes. </p>

<p>I've tried adding a ReadLn; to the end, but it only shows a blank console window when I do that, which makes sense. </p>

<p>I need to find a way to pause executing after the memory leak report, but before complete program shutdown. </p>

<p>I'm using Delphi 10 Seattle. </p>

<pre><code>program Project1;

{$APPTYPE CONSOLE}

uses
  System.Classes,
  System.SysUtils;

var
  s : TStringList;

begin
  try
    ReportMemoryLeaksOnShutdown := True;
    s := TStringList.Create;

    //ReadLn doesn't work here, which makes sense.
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
  //I need to be able to pause the program somewhere after the end statement here.
end.
</code></pre>