Re: Memory Management Question
Re: Memory Management Question
- Subject: Re: Memory Management Question
- From: "Daniel T. Staal" <email@hidden>
- Date: Mon, 2 Jul 2007 11:46:42 -0400 (EDT)
- Importance: Normal
On Mon, July 2, 2007 11:40 am, Seth Pellegrino said:
> Hello all,
>
> I'm getting a lot of EXC_BAD_ACCESS errors from my code, mostly
> because I call [object release] and then later on call [object
> someOtherMethod]. The workaround I've found is that every time I call
> [object release] I then assign object = nil, and every time I'm
> working with a possibly dead object, I wrap the code in an if
> (object) { } block.
>
> That seems like an odd way to manage objects, though. Am I doing
> something wrong, or is there at least a way to compress the "release
> and assign nil" block into one line?
Any particular reason you are trying to use objects after disposing of
them? In general, you don't throw things away until you are _done_ with
them...
Daniel T. Staal
---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
_______________________________________________
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