title: Delphi Service Application TStringList LoadFromFile Memory Leak
body: <p>Is there someone in there that can explain why my code causes a memory leakage of 4KB, looking on the TaskManager.  Delphi 2005, service application:</p>
  
  <pre><code>unit uMain;
  
  interface
  
  uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs,
    ExtCtrls;
  
  type
    TgwDebugService_s = class(TService)
      Timer1: TTimer;
      procedure Timer1Timer(Sender: TObject);
      procedure ServiceStop(Sender: TService; var Stopped: Boolean);
      procedure ServiceExecute(Sender: TService);
    private
      { Private declarations }
    public
      function GetServiceController: TServiceController; override;
      { Public declarations }
    end;
  
  var
    gwDebugService_s: TgwDebugService_s;
  
  implementation
  
  {$R *.DFM}
  
  procedure ServiceController(CtrlCode: DWord); stdcall;
  begin
    gwDebugService_s.Controller(CtrlCode);
  end;
  
  function TgwDebugService_s.GetServiceController: TServiceController;
  begin
    Result := ServiceController;
  end;
  
  procedure TgwDebugService_s.ServiceExecute(Sender: TService);
  begin
    // Service is Fired
    while not Terminated do
      ServiceThread.ProcessRequests(True);// wait for termination
  
  end;
  
  procedure TgwDebugService_s.ServiceStop(Sender: TService; var Stopped: Boolean);
  begin
    // Service stops
  
  end;
  
  procedure TgwDebugService_s.Timer1Timer(Sender: TObject);
  var
    sl : TStringList;
  begin
    Timer1.Enabled := False;
    Sleep(1000);
  
    sl := TStringList.Create;
    try
      //if FileExists( 'c:\OnlyOnMyPc\test.txt' ) then
      sl.LoadFromFile( 'c:\OnlyOnMyPc\test.txt' );  // remove this line and will be find
      sl.Add( 'Test @ ' + FormatDateTime( 'dd.mm.yyyy hh:mm:ss.z', Now ) );
      sl.SaveToFile( 'c:\OnlyOnMyPc\test.txt' );
    finally
      sl.Clear;
      FreeAndNil( sl );
    end;
  
    Timer1.Enabled := True;
  
  end;
  
  end.
  </code></pre>
  
  <p>Appreciate your time and your help.</p>
  
  <p>Cheers.
  gbp</p>