Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Objective-c > Retain and Rele...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 974 of 1009
Post > Topic >>

Retain and Release

by Linan <tali.wang@[EMAIL PROTECTED] > May 5, 2008 at 03:34 PM

Hi,
I just spent few hours and finally understand the two memory
management methods. I think the the pair just do not make sense (or
conceptually illogic). I feel it would be better if NSObject has two
other methods:
 -(void) retain:(id)obj;
 -(void) release:(id)obj;
In the dog and leash analogy suggested in the Aaron Hillegass's book,
it's the owners of the dog  retain or release the dog, but in object-c
the dog has to release/retain itself.
The real advantage of the idea is when using NSAutoreleasePool. It
would be conceptually simpler and more consistent than autorelease
method. We even don't need this method any more. Just alloc/init an
autoreleasepool and it again has the retain:(id)obj and release:
(id)obj methods.

How do you think? Please correct me if I failed to capture something
behind the design. Thanks

Linan Wang
 




 2 Posts in Topic:
Retain and Release
Linan <tali.wang@[EMAI  2008-05-05 15:34:08 
Re: Retain and Release
Gregory Weston <uce@[E  2008-05-06 07:48:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 5:45:29 CDT 2008.