Maybe a way to look at it is this:
If you create an object you do have the responsibility to ensure it is
freed (I'm differentiating that from a responsibility to free it).  You
can do this a number of ways including:
a) Free it yourself explicitly (e.g. in a finally block after you've
finished with it)
b) Delegate this responsibility to something else - e.g. if the
constructor takes an Owner parameter, you should be safe to rely on the
owner freeing it (the only downside to this is that you maybe have less
control over when it gets freed), or as stated, use ObjectLists or
ComponentLists.

It is all reasonably well documented, and it _is_ consistent when one
understands it - it does just require some attention from developers
when they're coding.  It should only be a worry if you're not following
the documentation... ;-)

HTH,

Conor

-----Original Message-----
From: Alistair George [mailto:[EMAIL PROTECTED]

Hello Phil,
PM> list. Either way - it's all in the helpfile... you know, the one
that came
PM> with Delphi ;-)
Yes, I did peruse that before asking. My understanding was that if you
create an
object, you must free it, which is what I was doing.
However, this rule of thumb obviously does not always apply, which is a
worry,
what else I am creating must be suspect as well if I try to free it.

It would seem that others with greater knowledge of programming have
similar problems as many components eg RXtools are attempting to free
nonexistent objects and I have read posts elsewhere where Graphics.pas
etc. is the cause of some (list) freeing errors. Not a perfect world eh.
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to