But beware.... it actually does NilAndFree.......  That is, it nils it
first.  Then attempts to free it.  If that fails, you have now lost memory
and not even know it.

Many people, including me, dont use it.

----- Original Message -----
From: "Corey Murtagh" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Monday, 7 May 2001 20:46
Subject: Re: [DUG]: Dispose Memory


> Peter Ingham wrote:
> >
> > On Mon, 7 May 2001 11:14:30 +1200, you wrote:
> >
> > >Dispose shouldn't cause an access violation - it's a good idea to set
the
> > >variable to nil after disposing and to test for nil before disposing.
> >
> > FYI Borland snuck a nice routine "FreeAndNil" into D5.
> >
> > It can be used with any object or pointer to Object,   the routine
> > test if the pointer is nil,  if not the objects free method is called,
> > then the pointer is set to nil.
>
> That sounds suspiciously like a routine I've written and used many times.
> Glad they finally decided to add it to the library :>
>
> --
> Corey Murtagh
> The Electric Monk
> "Quidquid latine dictum sit, altum viditur!"
> --------------------------------------------------------------------------
-
>     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"
>

---------------------------------------------------------------------------
    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"

Reply via email to