• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: noobie mem management problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: noobie mem management problem


  • Subject: Re: noobie mem management problem
  • From: mmalc Crawford <email@hidden>
  • Date: Thu, 26 Feb 2009 08:04:30 -0800


On Feb 26, 2009, at 6:10 AM, Peter N Lewis wrote:

The next issue (and this is almost certainly where your problem is) is that your @property is set to copy, so:
[self.currentStates addObject:@"hello"];
is equivalent:
[[self currentStates] addObject:@"hello"];
And [self currentStates] returns a copy of the NSMutableArray. And so you create a copy, then you add the string, then it is autoreleased.


No, this is wrong.
'copy' applies to the setter, not getter.
<http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html#//apple_ref/doc/uid/TP30001163-CH17-SW2 >


mmalc

_______________________________________________

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


  • Follow-Ups:
    • Re: noobie mem management problem
      • From: Peter N Lewis <email@hidden>
References: 
 >noobie mem management problem (From: James Cicenia <email@hidden>)
 >Re: noobie mem management problem (From: Peter N Lewis <email@hidden>)

  • Prev by Date: Re: One IBAction, multiple results from multiple methods
  • Next by Date: Re: One IBAction, multiple results from multiple methods
  • Previous by thread: Re: noobie mem management problem
  • Next by thread: Re: noobie mem management problem
  • Index(es):
    • Date
    • Thread