Help with a memory leak



Hi guys.

The main part of my application creates a thread every five minutes
that checks the email and then terminates (well I think it does). I am
not very good at threads so I am open to any offers of help.

Anyways, I create in this thread a couple of componets like
MailPop := TIdPOP3.Create(Nil);
MessageMemo := TStringList.Create;
MailMessage := TIdMessage.Create(Nil);
MailChecker := TTimer.Create(nil);


First question. IS the bit where I am using NIL correct or should it be
something else? And if so, how do I know what it should be?

At the end of the thread I use things like

MailPop.Free;
MailPop := nil;

to get rid of the bits and pices. However, each time my thread exits, I
was expecting some memory used when the thread was created, to be
returned to the system but it doesn't seem to. It looks as though it
uses a bit more each time without returning any at the end.

And lastly, should I set freeonterminate to TRUE? I don't use that
statement at all so

it looks like

MailClient := Tmailthread.Create(True);
MailClient.Resume;

Help and ideas most welcome. The app runs for a couple of days and
then seems to grind to a halt....

I use d6 enterprise with no service packs...

Peter

.