Search the Community
Showing results for tags 'memory;'.
Found 2 results
-
In Windows you can use the function " EmptyWorkingSet(GetCurrentProcess) " (from WinAPI.PsAPI) to release all memory to OS. I use it on my application when the memory used is over 50% of all system memory (this help also to reduce the effects of fragmentation). My applications use lot of images, near 2000 raw buffers / second (form some KB to some MB) and fragmentation is high. Every 4 / 5 days I look (from logs) that the application use that function. Normally the application stay on near one year, actively working 10 hours per day. You should look for equivalent function in Linux (I'm quite sure that should exists). Bye
-
memory; Memory not freed in Linux but freed in Windows
michel.seicon posted a topic in Cross-platform
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.