Re: [Newbie Q] Memory Management in Cocoa
Re: [Newbie Q] Memory Management in Cocoa
- Subject: Re: [Newbie Q] Memory Management in Cocoa
- From: Ondra Cada <email@hidden>
- Date: Wed, 6 Nov 2002 00:11:08 +0100
On Wednesday, November 6, 2002, at 12:11 , Jonathan E. Jackel wrote:
I'd rather look at the object as shared. Creating it and retaining it
seems to me equivalent in the sense that both chunks of code -- the one
who alloc/init'd, and the one who retained -- have precisely the same
rights and duties so far as the object in question is concerned. If you
insist of speaking ownership, then the object has more owners at once ;)
I've always liked the dog-leash metaphor. Imagine a dog. If you want to
walk the dog you put a leash on his collar. But the dog is very popular.
Any number of people can "retain" the dog by adding any number of leashes.
When each person is tired of walking the dog, he/she releases the leash.
When the last person let's go of the last leash, the dog is "freed"...
...and runs away, never to be seen anymore ;)
Yup, and -- what's IMHO important here -- you operate the leash precisely
the same way regardless you bred the beast from a puppy or just added your
leash recently.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.