Hello,
The memory is not freed and the program keeps the memory, this does not happen in Windows and only in Linux. Below is a simple example,
but in everyday if the system is running for a few days the memory usage ends up being excessive,
this does not happen in Windows Is necessary restar the program everday.
Affected
Debian 12, Delphi 11.2 Path 1
Ubuntu 22.04 Delphi 12.1.
Sample simple program
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
System.Classes;
type
TListaString = class
V_String:String;
end;
var
V_Listas: TList;
ii, i : integer;
V_Lista : TListaString;
V_Run : Boolean;
begin
V_Run := true;
V_Listas:=TList.Create;
try
while true do
begin
if V_Run then
begin
V_Run := false;
for i := 0 to 3000 do
begin
V_Lista := TListaString.Create;
for ii := 0 to 10000 do
V_Lista.V_String := V_Lista.V_String + IntToStr(Random(99999));
V_Listas.Add(V_Lista);
end;
writeln('create 1');
sleep(5000);
for i := 0 to 3000 do
begin
V_Lista := TListaString.Create;
for ii := 0 to 10000 do
V_Lista.V_String := V_Lista.V_String + IntToStr(Random(99999));
V_Listas.Add(V_Lista);
end;
writeln('create 2');
sleep(5000);
for i := 0 to 3000 do
begin
V_Lista := TListaString.Create;
for ii := 0 to 10000 do
V_Lista.V_String := V_Lista.V_String + IntToStr(Random(99999));
V_Listas.Add(V_Lista);
end;
writeln('create 3');
sleep(5000);
while V_Listas.Count > 0 do
begin
TListaString(V_Listas[0]).V_String := '';
TListaString(V_Listas[0]).Free;
V_Listas.Delete(0);
end;
V_Listas.Free;
end;
writeln('free, but not free');
sleep(5000);
end;
{ TODO -oUser -cConsole Main : Insert code here }
except
on E: Exception do
writeln(E.ClassName, ': ', E.Message);
end;
end.