I developed a program with Apache, Delphi XE7 and Datasnap. My Apache httpd.exe consumes memory until it gives the message "Out of Memory" so I need to restart Apache.
I configured ServerModule (FireDac, Mysql components) and WebModule to execute a simple query.
In the Client I have a
DBGrid that shows the results of the Query
With Task Manager open and monitoring memory:
- When connecting and disconnecting the
TSQLConnectionor opening and closing the
TClientDataSetthe memory increases.
What I already tried to do:
I ran Pascal Analyzer looking for memory leaks but it's ok, I tried turning off Apache keep alive but it made no difference, I've used all types of WebModule lifecycle (Session, Server and Invocation) but the problem persists.
Thanks in advance.
Try the code below, I believe it helps.
procedure TformPrincipal.LimpaMemoria; var MainHandle : THandle; begin try MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID) ; SetProcessWorkingSetSize(MainHandle, $FFFFFFFF, $FFFFFFFF) ; CloseHandle(MainHandle) ; except end; Application.ProcessMessages; end;