Jump to content

michel.seicon

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

1 Neutral
  1. michel.seicon

    Memory not freed in Linux but freed in Windows

    @Lars Fosdal Dear Lars Fosdal Thank you very much for your tip. To solve the problem, simply call the "libc" library function. Below if you have the same problem type TMalloc_trim = function: Integer; cdecl; var LibHandle: THandle; Malloc_trim:TMalloc_trim; const SOName = 'libc.so.6'; begin LibHandle := LoadLibrary(PChar(SOName)); Malloc_trim := GetProcAddress(LibHandle, PChar('malloc_trim')); if Malloc_trim=1 then showmessage('Success') esle showmessage('Memory freeing not allowed'). Please close this case.
  2. michel.seicon

    Memory not freed in Linux but freed in Windows

    I just did an interesting test. Using wine on Linux to run the program made on Windows, the memory is freed normally as expected. The problem is isolating itself in Delphi/Linux
  3. michel.seicon

    Memory not freed in Linux but freed in Windows

    I think Embarcadero didn't do a good job on the compiler for Linux. Does anyone have Kylix to test it with an example. So we can isolate the problem in the Compiler or in the Memory Manager used for Linux. There must be few systems developed for Linux in Delphi running as a service. So these bugs should start to appear as more systems appear, like my case. Function like SetProcessWorkingSetSize(MainHandle, $FFFFFFFF, $FFFFFFFF) ; They are not necessary The tests I carried out were Delphi Windows ok Delphi Linux problem Lazarus Windows ok Lazarus Linux ok Kylix Linux untested(need help)
  4. michel.seicon

    Memory not freed in Linux but freed in Windows

    I don't need to use Google, I'm testing it in practice, please use the example like this and test it on Linux, Windows with Delphi and Lazarus so you can prove what I say. I prefer to check what I'm seeing than messages on Google that don't reflect reality.
  5. michel.seicon

    Memory not freed in Linux but freed in Windows

    Hey guys, Note that this example I posted is a simple code that shows that in Linux the memory is simply not freed even if the object is freed, in Windows this simply does not happen, anyone who has doubts can do the test and check. Unused memory must be returned to the OS, because if this did not happen, imagine how database systems or systems that need to be running constantly would increase memory usage due to fragmentation, this does not make any sense. As I said , test the code on Linux and Windows to see the result. Obs: In (Lazarus/Freepascal/Linux/Windows) , (Delphi/Windows) , the problema not occur. Only Delphi/Linux I posted https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-744
  6. michel.seicon

    Memory not freed in Linux but freed in Windows

    Hello Lars Fosdal Thank you for your lesson, but this does not explain the reason for the memory not being released while the program is running. Of course, this was a small example that we managed to diagnose in the middle of our source. In the example above, if you increase the loop so that it consumes 4gb, and at the end release the objects, the correct thing would be to release this memory to the OS The problem is that in our system, if we manipulate images, files, and send them via Sockets then over time the system simply consumes a lot of memory and never releases it. As I mentioned, this problem simply does not occur on Windows and only on Linux. Obs: In Lazarus/Freepascal the problema not occur.
  7. 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.
×