Re: Garbage collection with -finalize?
Re: Garbage collection with -finalize?
- Subject: Re: Garbage collection with -finalize?
- From: Shawn Erickson <email@hidden>
- Date: Wed, 30 Nov 2005 17:45:58 -0800
On 11/30/05, Andrew Merenbach <email@hidden> wrote:
> What is this -(void)finalize method in NSObject's docs (running Xcode
> 2.2 under Tiger 10.4.3, with the November documentation patch applied)?
>
> > Called by the garbage collector when the receiver is not referenced
> > by other objects.
> > Note: Garbage collection is not available for use in Mac OS X
> > v10.4, nor in earlier versions.
> > The garbage collector invokes this method on the receiver before
> > disposing of the memory it uses. When garbage collection is
> > enabled, this method is invoked instead of dealloc.
> >
> > Override this method to relinquish resources the receiver has
> > obtained:
> >
> > ...
> >
> > It is an error to store self into a new or existing live object
> > (colloquially known as "resurrection"), which implies that this
> > method will be called only once. However, the receiver may be
> > messaged after finalization by other objects also being finalized
> > at this time, so your override should guard against future use of
> > resources that have beeen reclaimed, as shown by the log_file =
> > NULL statement in the example.
> >
> > Availability
> > Available in Mac OS X v10.4 and later.
> >
> > See Also: – dealloc
>
> A garbage collection method available in 10.4, when garbage
> collection isn't available in 10.4? If this is new, why might I not
> have found a great deal of speculation, from this addition, on
> whether Mac OS 10.5 or 10.4.8 or something in the far future would
> allow it?
Also note...
<http://developer.apple.com/documentation/DeveloperTools/gcc-4.0.1/gcc/Garbage-Collection.html#Garbage-Collection>
Garbage collection is not yet supported on Mac OS X 10.4 (likely a
framework issue more then runtime library) but Apple is working on it,
why finalize showed up in NSObject. I doubt you will see it become
supported before 10.5 (assuming it become supported in 10.5).
-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden