Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED[ Re: Properties and memory management



Thanks! For some reason I was finding it extremely hard to find the answer in the docs.

Mike

On Aug 4, 2008, at 8:55 PM, Jonathan Hess wrote:

Hey Mike -

The implementation of the property will manage the retaining and the releasing. You only need to worry about sending retain and release messages manually if you access the instance variable directly (not through a property). The only place you would typically need to do that would be in your dealloc method.

Jon Hess

On Aug 4, 2008, at 8:51 PM, Mike Manzano wrote:

Hi,

Sorry about this cross-post, but the obj-c language list seems sort of dead.

If I have a property:

@property( retain ) NSString *blah ;

and in my code I assign it:

myObj.blah = @"woot!" ;

and then I want to reassign it, do I have to release it?

[myObj.blah release] ;
myObj.blah = @"new woot!" ;

or does the new assignment automatically release the retain? How about for

@property( copy ) NSString *blah ;

Do I have to release the copy?

Thanks,

Mike
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Properties and memory management (From: Mike Manzano <email@hidden>)
 >Re: Properties and memory management (From: Jonathan Hess <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.