Board index » delphi » delphi, COM+, ADO... memory leak?

delphi, COM+, ADO... memory leak?


2006-07-06 04:42:18 AM
delphi166
hi there,
i'm facing an annoying problem here...
while using the COM+ dlls we developed, Windows task manager shows the
memory usage of dllhost.exe growing indefinitively...
ok, i know task manager is not a leak detector tool, but i can't
explain to my supervisor why the process memory behaves like that...
sometimes the amount of memory reaches 1GB!!! then the process has to
be restarted manually... unfortunately we can not use WinXP, Win2K3
automatic recycling option, 'cause most of our clients use Win2K...
i've used memproof, memcheck and aqtime and found no memory leaks in
routines we are responsible for. could this leak (if it is a leak)
happens on ADO routines? COM+ routines? could it be a resource usage
problem? I am completely lost... :o(
anyone has any idea, suggestion, hints? anything is valid... don't be
shy...
if you need more information ask me...
TIA,
Zed
 
 

Re:delphi, COM+, ADO... memory leak?

Hoi Zed
You need to repost your message on the Borland news server to make
everybody see it and possibly answer your message.
How to post to Delphi newsgroups:
<delphi.wikia.com/wiki/Delphi_Newsgroups>
 

Re:delphi, COM+, ADO... memory leak?

hi there,
i'm facing an annoying problem here...
while using the COM+ dlls we developed, Windows task manager shows the memory usage of dllhost.exe growing indefinitively...
ok, i know task manager is not a leak detector tool, but i can't
explain to my supervisor why the process memory behaves like that...
sometimes the amount of memory reaches 1GB!!! then the process has to be restarted manually... unfortunately we can not use WinXP, Win2K3 automatic recycling option, 'cause most of our clients use Win2K...
i've used memproof, memcheck and aqtime and found no memory leaks in routines we are responsible for. could this leak (if it is a leak) happens on ADO routines? COM+ routines? could it be a resource usage problem? I am completely lost... :o(
anyone has any idea, suggestion, hints? anything is valid... don't be shy...
if you need more information ask me...
TIA,
Zed
 

Re:delphi, COM+, ADO... memory leak?

thx!
Z
Riki Wiki escreveu:
Quote
Hoi Zed

You need to repost your message on the Borland news server to make
everybody see it and possibly answer your message.

How to post to Delphi newsgroups:
<delphi.wikia.com/wiki/Delphi_Newsgroups>
 

Re:delphi, COM+, ADO... memory leak?

Hi!
I am also using COM+ ADO (Delphi 2006) and have not seen any memory
leaks. On the other hand you do not need to have a "memory leak" to get
the behavior you describe.
You perhaps allocate memory that is freed on shutdown of the
application. That would not be a "memory leak" and would not be detected
by mem-leak tools.
Some more information as how you are using com+ would be interesting.
Are you using TMtsAutoObject or perhaps TMtsDataModule?
Do you have any sample code that produces the "leak"?
Because I am using this myself I am very interested to find out what the
problem is so that I can avoid it myself.
regards
/Micke
Zed Martins writes:
Quote
hi there,

i'm facing an annoying problem here...


ok, i know task manager is not a leak detector tool, but i can't
explain to my supervisor why the process memory behaves like that...
sometimes the amount of memory reaches 1GB!!! then the process has to be restarted manually... unfortunately we can not use WinXP, Win2K3 automatic recycling option, 'cause most of our clients use Win2K...

i've used memproof, memcheck and aqtime and found no memory leaks in routines we are responsible for. could this leak (if it is a leak) happens on ADO routines? COM+ routines? could it be a resource usage problem? I am completely lost... :o(

anyone has any idea, suggestion, hints? anything is valid... don't be shy...

if you need more information ask me...

TIA,

Zed
 

Re:delphi, COM+, ADO... memory leak?

Hi Mikael, thanks for your response...
i got some new information about the problem...
we are using TMtsDataModule to create our dlls. i don't know if this is the best option though.
i tested the dlls without registering them on component services, just using regsvr32. in that case, the dlls are called in the same process of scktsrvr.exe and so, the aqtime can detect leaks that wouldn't be detected using dllhost.exe. No leaks at all...
but...
using aqtime to profile the resources allocation, a strange thing came out. aqtime detected 463 allocations of Task Memory objects using almost 10KBytes that were not freed when the scktsrvr was terminated. analysing the call stack from these 'leaks', i noticed that almost 95% of them had the same behaviour:
bib.dll vclcom.pas(1294) TVCLAutoObject::Invoke
bib.dll vclcom.pas(1112) InsertSQLID
bib.dll adodb.pas(3441) TADOCommand::Execute
bib.dll adodb.pas(3449) TADOCommand::Execute
bib.dll adodb.pas(3460) TADOCommand::Execute
ole32.dll CoTaskMemAlloc
we changed the vclcom.pas to add some routines (InsertSQLID and DeleteSQLID) that inserts data from client-side into a database table before every call to the datamodule methods.
can be this the cause of the problem? how can i correct this?
thanks!!!
peace!
Z
Mikael Eriksson <XXXX@XXXXX.COM>writes:
Quote
Hi!

I am also using COM+ ADO (Delphi 2006) and have not seen any memory
leaks. On the other hand you do not need to have a "memory leak" to get
the behavior you describe.
You perhaps allocate memory that is freed on shutdown of the
application. That would not be a "memory leak" and would not be detected
by mem-leak tools.
Some more information as how you are using com+ would be interesting.
Are you using TMtsAutoObject or perhaps TMtsDataModule?
Do you have any sample code that produces the "leak"?
Because I am using this myself I am very interested to find out what the
problem is so that I can avoid it myself.

regards

/Micke



Zed Martins writes:
>hi there,
>
>i'm facing an annoying problem here...
>
>
>ok, i know task manager is not a leak detector tool, but i can't
>explain to my supervisor why the process memory behaves like that...
>sometimes the amount of memory reaches 1GB!!! then the process has to be restarted manually... unfortunately we can not use WinXP, Win2K3 automatic recycling option, 'cause most of our clients use Win2K...
>
>i've used memproof, memcheck and aqtime and found no memory leaks in routines we are responsible for. could this leak (if it is a leak) happens on ADO routines? COM+ routines? could it be a resource usage problem? I am completely lost... :o(
>
>anyone has any idea, suggestion, hints? anything is valid... don't be shy...
>
>if you need more information ask me...
>
>TIA,
>
>Zed
 

Re:delphi, COM+, ADO... memory leak?

I am sorry but I can't see what the problem is here. I do not use the
TMTSDataModul myself but I have tried it now with a TADODataSet and
TDataSetProvider on a server and a TDCOMConnection and TClientDataSet on
the client without any problem. I have of course not made the
modifications you have made.
I can only recommend you to make the simplest of application using a
TMTSDataModule and add one feature at a time to see what modification
makes your server leak memory.
regards
/Micke