title: Memory Leaks with TList<T>.Pack
body: <p>Consider a simple class TMyObject that contains an array[0..9] of string (Description) and some other properties (omitted for this example).  At a certain point, I want to remove all &quot;empty&quot; objects (i.e. where all 10 string are empty) from FMyList (TList&lt;TMyObject&gt;).  For this purpose I am using the Pack method with the IsEmpty function:</p>
  <pre><code>FMyList.Pack(
    function(const MyObject1, MyObject2: TMyObject): boolean
    var
      ii: Integer;
    begin
      result := true;
      for ii := 0 to 9 do
        if (MyObject1.Description[ii] &lt;&gt; '') then
        begin
          result := false;
          break;
        end;
    end);
  </code></pre>
  <p>Initially I (wrongfully) assumed Pack would also free (release) the objects.  This is not the case, so the above code causes memory leaks, leaving the removed TMyObjects &quot;dangling&quot;.</p>
  <p>Unfortunately, the documentation is a bit sparse on Pack.  How to correctly use this method and ensure that after a Pack, not only are the objects removed from the TList but also correctly freed?</p>