• 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
autorelease - when is retain count decremented
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

autorelease - when is retain count decremented


  • Subject: autorelease - when is retain count decremented
  • From: justin webster <email@hidden>
  • Date: Wed, 15 Sep 2004 08:41:25 +1200

just wondering what causes the retain count of an object to drop.
this is the situation I've been wondering about:

NSString *myString = [NSString stringWithFormat:@"testing"];
myString = anotherString;

when I point myString away from the 'testing' string, does the 'testing' memory get freed?
or should I release myString before pointing it to something else?


also, in this situation do I now have two pointers to the same piece of memory, and therefore a retain count of two?


_______________________________________________ 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
  • Follow-Ups:
    • Re: autorelease - when is retain count decremented
      • From: Scott Stevenson <email@hidden>
    • Re: autorelease - when is retain count decremented
      • From: David Reed <email@hidden>
    • Re: autorelease - when is retain count decremented
      • From: j o a r <email@hidden>
    • Re: autorelease - when is retain count decremented
      • From: Nick Zitzmann <email@hidden>
    • Re: autorelease - when is retain count decremented
      • From: Shawn Erickson <email@hidden>
    • Re: autorelease - when is retain count decremented
      • From: Frederick Cheung <email@hidden>
  • Prev by Date: Re: @protected variable access
  • Next by Date: Re: controlTextDidChange, backspace possible?
  • Previous by thread: Re: XCode Unknown class
  • Next by thread: Re: autorelease - when is retain count decremented
  • Index(es):
    • Date
    • Thread