Re: object Allocation
Re: object Allocation
- Subject: Re: object Allocation
- From: Fritz Anderson <email@hidden>
- Date: Wed, 19 Apr 2006 15:36:27 -0500
Reservations clerk, testily: I _know_ what a "reservation" is, sir!
Jerry Seinfeld: No, I don't think you do. If you did, we wouldn't be
having this problem.
On Apr 19, 2006, at 3:18 PM, Jerrod Fowkes wrote:
thank you, however I have a firm enough grasp on retain and
release. I just need to know where it is being applied.
Objects returned from most methods are autoreleased (or at least not
incremented in retain count for your purposes), unless the method
contains the words "alloc," "new," or "copy." (There is one
exception, a "new" in Core Data, but it is very embarrassed.) In the
method name in
newDictionary = [NSDictionary dictionaryWithDictionary: oldDictionary];
none of the magic words appear. This means that the returned object
is subject to deallocation in the next iteration of the run loop. In
newDictionary = [[NSDictionary alloc] initWithDictionary:
oldDictionary];
the magic word "alloc" appears. It's your responsibility to release it.
The tutorial Nick (quite civilly) referred you to explains this.
-- F
_______________________________________________
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