I am using Delphi 2009 which has the FastMM4 memory manager built into it.
My program reads in and processes a large dataset. All memory is freed correctly whenever
You could use VMMap to trace the most allocated bytes. It helped me for an similar scenario.
When the app opens, VMMap will trace all allocated and freed memory using detours in allocate/free methods. You can see in Timeline button (on the botton of VMMap) the timeline of memory (obviously).
Click in Trace button. It will show all the allocations/dealocattions operations in the traced time. Order the column Bytes to show the most bytes first, and double click it. It will show the callstack of the allocation. In my case, the first item showed my problem.
Sample app:
private
FList: TObjectList;
...
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin
for i := 0 to 1000000 do
FList.Add(TStringList.Create);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
a: TStringList;
begin
FList := TObjectList.Create; //not leak
a := TStringList.Create; //leak
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FList.Free;
end;
When clicking in button one time, and see the Trace in VMMap, shows:
And the callstack:
In this case did not show exactly the code, but the Vcl.Controls.TControl.Click give an idea. In my real scenario, helped more.
There is a lot of others functionalities in VMMap that helps analising memory problems.