Re: dealloc and finalize
Re: dealloc and finalize
- Subject: Re: dealloc and finalize
- From: Nick Zitzmann <email@hidden>
- Date: Fri, 9 Oct 2009 11:39:11 -0600
On Oct 9, 2009, at 11:31 AM, Gabriel Zachmann wrote:
If my screensaver must be able to run both in the reference-counted
and in the garbage collecting environment,
should I then implement both the dealloc and the finalize method?
If you allocated objects in your class that you need to deallocate
before going bye-bye, or you registered the class for notifications,
then yes, you must implement a -dealloc method unless your code is GC-
only. You only need to implement -finalize if you allocated memory
outside the garbage collector (for example, using malloc()) and need
to free it before the object goes away. Check the documentation for
more information.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden