On Wed, Nov 19, 2008 at 6:17 PM, Filip van der Meeren
<[EMAIL PROTECTED]> wrote:
> If you wait until the end of your method to autorelease the object, you are
> leaving a whole range of possible memoryleaks open, since every call you
> make between the allocation and release is a call that might throw an
> exception (and we all know Objective-C uses memoryjumps from C).

Gah!  You have no idea when an autoreleased object is going to be
released.  What if a method call you make in between autoreleasing the
object and really not needing it anymore hits the top of the runloop?
Boom, your autoreleased object is gone.  As the documentation states,
only use autorelease to signal that you no longer need an object.

As for exceptions, that's why we have @finally blocks.  Though since
exceptions in Cocoa are supposed to be reserved for programmer errors,
I would not worry all that much about exceptions and memory leaks.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to