• 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
NSString Retain Count of 2147483647
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString Retain Count of 2147483647


  • Subject: NSString Retain Count of 2147483647
  • From: Thomas Wetmore <email@hidden>
  • Date: Wed, 24 Jun 2009 10:26:16 -0400

I know you're not supposed to use retain counts when debugging memory issues, but I have found it very (VERY) useful at times. While looking at retain counts of NSStrings I have found an oddity that I think I understand, but would like confirmation if possible.

When I use NSScanners to chop strings up, whenever I pull a one- character string out of a scanner that string has a retain count of 2147483647 (2**32 - 1). My guess is that there are pre-allocated, one- character strings for all (most?) characters that are given this maximum possible value of a retain count, the digital equivalent of infinity. Then these one-character strings can be released pretty much to one's heart's content but never deallocated unless there is an incredible bug, in which case I'm guessing that another such one- character string would be allocated to replace it.

Can anyone confirm this suspicion?

Thanks.

Tom Wetmore, curious Xcoder
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSString Retain Count of 2147483647
      • From: "Sean McBride" <email@hidden>
    • Re: NSString Retain Count of 2147483647
      • From: Gwynne Raskind <email@hidden>
    • Re: NSString Retain Count of 2147483647
      • From: Clark Cox <email@hidden>
    • Re: NSString Retain Count of 2147483647
      • From: Hamish Allan <email@hidden>
  • Prev by Date: debugger console
  • Next by Date: Re: NSString Retain Count of 2147483647
  • Previous by thread: debugger console
  • Next by thread: Re: NSString Retain Count of 2147483647
  • Index(es):
    • Date
    • Thread