I'm using a Remote Data Module in a Apache Server, and clients using
TWebConnection.
My RDM is a .exe. Everthing is ok, but I have a little problem:
My app clients are connecting with the RDM in 1 minute intervals to perform
some operations.
In each connection, the RDM consumes a amount X of memory, and does not free
that memory after disconnecting.
The executable process stays running all the time and the memory usage is
always increasing.
I wrote an FreeAndNil(self) (self=RDM) but does not matter.
What is wrong?
Sorry for my bad english, and thanks in advance.
Ricardo Carmo
Ricardo Carmo
"Ricardo Carmo" <nwl...@yahoo.com.br> escreveu na mensagem
news:486a...@newsgroups.borland.com...
There can be lots of circunstances ...
Are you creating RDM in your own code?. How?. In the main thread?.
What kind of components are you creating for each RDM instance?. Are you
cleanning those components after using them?.
Phil.
No. I'm using a "blank" RDM, created by Wizard in
File->New->Other->Multitier->Remote Data Module.
> What kind of components are you creating for each RDM instance?. Are you
> cleanning those components after using them?.
I'm using the components that I need: IBDatabase, IBQuerys,
DataSetProviders.
Some components are created in design time, others in runtime.
And yes, I'm cleanning those components. What I did was:
a) My RDM have a method "CloseMyConnection" executed by the client app.
This method perform a RDM.Components[0].Free while ComponentCount>0;
After all, this method perform a FreeAndNil(self) where self is the RDM.
b) The client app perform a RDM.Disconnect.
In this time, all works fine, but the executable process stays running, and
the
allocated memory does not decrease.
Any ideas?
Thanks.
"PhilDGS" <phi...@hotmail.com> escreveu na mensagem
news:486a...@newsgroups.borland.com...
Try to destroy RDM from outside of it (same level in where you created it),
and see what happen.
Phil
How? I don't know to do this. Because...
the httpsrvr.dll launches the RDM executable ( I'm using WebConnection on
the client);
I think that the RDM is created on the code below:
initialization
TComponentFactory.Create(ComServer, TMyRDM,
Class_MyRDM, ciMultiInstance, tmApartment);
But this source-code is on the RDM's unit...
I'm confused. Can you help me?
Ricardo.
"PhilDGS" <phi...@hotmail.com> escreveu na mensagem
news:486ac3e4$1...@newsgroups.borland.com...
That's sound much better !!!, because it's suposed RDM will be automatically
destroyed when you close the client connection. So, try to left it alone (I
mean, don't call your RDM.CloseMyConnection).
At least, I use DataSnap/Midas and RDMs are created/destroyed automatically
when each client connects/disconnects.
Phil
PhilDGS is right. Do NOT free your RDM manually, calling a remote method
from the client application.
Whenever you close the WebConnection (freeing it or closing it explicitly)
your RDM instance will be destroyed as well.
Try to put some OutputDebugString in OnDestroy event handler, like this:
procedure TMyRemoteDM.RemoteDataModuleDestroy(Sender: TObject);
begin
OutputDebugString(PChar(ClassName + '.Destroy'));
end;
You can play with it and see if it is being destroyed as you close the
connections.
PS: Use DebugView (http://download.sysinternals.com/Files/DebugView.zip) to
"catch" the OutputDebugString messages.
Regards.
I have discovered that the problem is in the client app.
My client app is a Windows Service. If I do connect to RDM from a Windows
App,
the RDM is destroyed after close connection, but if I connect from a Windows
Service,
the RDM is not destroyed. Any ideas?
Thanks.
Ricardo Carmo
"Alexandre Machado" <alexandre@f#ckspamconsultbrasil.com.br> escreveu na
mensagem news:486c...@newsgroups.borland.com...
1. If I disconnect from the RDM with no RDM methods called, the RDM is
destroyed.
2. If I call any method from the RDM, after disconnect the RDM does not
destroyed.
What's wrong?
Ricardo
"Alexandre Machado" <alexandre@f#ckspamconsultbrasil.com.br> escreveu na
mensagem news:486c...@newsgroups.borland.com...
Opt. 1 is the right way. Simply disconnect the client and the server will
destroy the RDM alone.
Phil.
If app client connects to RDM and does not call a RDM's function or
procedure,
when it disconnects, the DRM is destroyed. That's ok.
But...
If app client connects to RDM and CALLS a RDM's function or procedure after
that,
when it disconnects, the RDM is not destroyed.
Do you undestand now?
"PhilDGS" <phi...@hotmail.com> escreveu na mensagem
news:486d...@newsgroups.borland.com...
http://www.distribucon.com/midasbug/results.asp?DelphiVersion=11
This bug applies only to TWebConnection.
Thanks Phil.
Problem fixed.
Ricardo.
"Ricardo Carmo" <nwl...@yahoo.com.br> escreveu na mensagem
http://www.distribucon.com/midasbug/results.asp?DelphiVersion=11
Que bom que eu encontrei. Se não desse pra resolver, esta solução de
utilizar RDM via HTTP ficaria inviável.
De qualquer modo, obrigado.
Ricardo Carmo
"Alexandre Machado" <alexandre@f#ckspamconsultbrasil.com.br> escreveu na
mensagem news:486c...@newsgroups.borland.com...