I am currently developing this application that heavily relies on
tstringlist. Allthough I free and nil this object it doesnt seem to free the
memory at all. I am using the freeandnil function for this. Any ideas? Is
there any better internal structures to store temporary data then
tstringlist?
Also, I found that the ado component have a big memory leak and causes a lot
of pagefaults. Is this something common? I am connectiong to an access
database using the ado component shipped with D5 enterprise.
Thanks for any comments,
Michael
--
Software engineer
glopro.com
--
Paul Nicholls (Delphi 5)
"The plastic veneer of civilized man is easily melted in the heat of the
moment" - Paul Nicholls
Home Page: www.southcom.com.au/~phantom
< IF YOU WANT TO EARN MONEY WHILE YOU SURF ON THE NET GO HERE: >
< http://www.alladvantage.com/go.asp?refid=BEM-274 >
How are you judging that the memory has not been released? If you're
using Task Manager, don't -- the numbers displayed there have little to
do with actual memory usage. If you're using MemProof or BoundsChecker,
those programs give you good numbers and tell you exactly what is
causing the leak. If you're using one of these, please tell us where
the resource was created.
> Is
> there any better internal structures to store temporary data then
> tstringlist?
TStringList is pretty good.
> Also, I found that the ado component have a big memory leak and causes a lot
> of pagefaults. Is this something common? I am connectiong to an access
> database using the ado component shipped with D5 enterprise.
You can repeat your question on
borland.public.delphi.database.adoexpress if you want, but bear in mind
what I said above about Task Manager. You can get MemProof for free
from:
http://www.automatedqa.com/downloads/memproof.asp
So first find out exactly what is causing the leak.
HTH,
-Craig
--
Craig Stuntz (TeamB) Vertex Systems Corporation
Senior Developer http://www.vertexsoftware.com
Delphi/InterBase weblog: http://delphi.weblogs.com
This is wrong. It's not necessary to use Clear. If you're storing
object references in the Objects property, however, you'll have to Free
them manually, if it's not done elsewhere.
I use the addobject method to add strings into the tstringlist.
For example
type
PQue = ^AQue;
AQue = record
url: string;
host: string;
filename: string;
id: integer;
end;
..
var
urlInfo : PQue;
new(urlInfo)
urlinfo^.host := 'borland.com';
urlinfo^.url := 'www.borland.com';
urlinfo^.filename := 'default.asp';
urlInfo^.id := 1;
list.addobject("path",TObject())
this is looped through with different data. Now how can I delete this in a
correct way. Since at the moment I simply just freeandnil(list);
which doesnt work. Do I have to free the object too? And I think that is the
problem, but how I can do this?
Cheers
Michael
"Craig Stuntz (TeamB)" <cstuntz@no_spam.vertexsoftware.com> wrote in message
news:3AAD708A.10B937C6@no_spam.vertexsoftware.com...
> type
> PQue = ^AQue;
> AQue = record
> var
> urlInfo : PQue;
> new(urlInfo)
> urlinfo^.host := 'borland.com';
> urlinfo^.url := 'www.borland.com';
> urlinfo^.filename := 'default.asp';
> urlInfo^.id := 1;
> list.addobject("path",TObject())
I presume the above is a typo and actually reads
list.AddObject ('path', tObject (urlInfo));
>
> this is looped through with different data. Now how can I delete this in a
> correct way. Since at the moment I simply just freeandnil(list);
>
> which doesnt work. Do I have to free the object too? And I think that is
the
> problem, but how I can do this?
Yes, not releasing the records is a leak. Try something like
var i : integer;
for i := 0 to (list.Count - 1) do
Dispose (aQue (list.Objects [i]));
FreeAndNil (list);
Hi,
I encountered problems trying to use declarations like that.
Try this:
AQue = record
url: string[255];
host: string[255];
filename: string[255];
id: integer[255];
end;
or use PChar if string[255] is too small but you have to get and free memory
for the items separately.
Mark