On Sat, Oct 22, 2011 at 9:36 AM, Frank Church <vfcli...@gmail.com> wrote:
> Does that mean that Free itself reclaims the memory used by the object's
> fields and properties but does not release the memory used by the TObject or
> pointer itself, where as setting it to nil or executing Destroy does, or
> does Destroy do something different?

No, you got parts of it wrong:

*Free calls Destroy which releases the memory of the object itself.

*Nothing releases the memory of the pointer to the object. You don't
want to release the 4 or 8 bytes of the pointer. If you did release
it, then your application would crash when trying to read the pointer
to check if it is nil.

*Destroy implements releasing the memory of the object. Free calls Destroy.

*Setting the object to nil does just that. It changes the pointer to
the object to have the value nil (zero). It does not release the
pointer.

-- 
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to