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

Re: NSString Retain Count of 2147483647


  • Subject: Re: NSString Retain Count of 2147483647
  • From: Martin Redington <email@hidden>
  • Date: Wed, 24 Jun 2009 16:45:08 +0100

On Wed, Jun 24, 2009 at 4:05 PM, Clark Cox<email@hidden> wrote:
> On Wed, Jun 24, 2009 at 7:58 AM, Gwynne Raskind<email@hidden> wrote:
>> On Jun 24, 2009, at 10:26 AM, Thomas Wetmore wrote:
>
>> What you're talking about is an internal implementation
>> detail. You can't expect to rely on it for more than five minutes at a time.
>> If monitoring the retain count of an object is the answer to your problems,
>> then you're going about things completely wrong. Autorelease pools and
>> singleton objects, to name two examples, make the use of retain counts in
>> debugging a complete fallacy.
>
> I can't second this advice enough. Anytime you're looking at the
> retainCount directly, you're probably overthinking your issue.

Is that really always true?

I recently did a pass over one of my apps to correct some issues that
static analysis had thrown up, and also did some cleanup of memory
usage/issues - mostly over-retains as it turns out.

I found that inspecting retainCount with caveman debugging, and
over-riding retain/release/dealloc very helpful in some specific
contexts, for example to catch bugs like

id someObject = [[MyObject alloc] init];
[someArray addObject:someObject];
[someObject release];

// Oops. someArray was nil, and now someObject is gone
 _______________________________________________
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: Bill Bumgarner <email@hidden>
    • Re: NSString Retain Count of 2147483647
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >NSString Retain Count of 2147483647 (From: Thomas Wetmore <email@hidden>)
 >Re: NSString Retain Count of 2147483647 (From: Gwynne Raskind <email@hidden>)
 >Re: NSString Retain Count of 2147483647 (From: Clark Cox <email@hidden>)

  • Prev by Date: Re: Code sign issues
  • Next by Date: Re: NSString Retain Count of 2147483647
  • Previous by thread: Re: NSString Retain Count of 2147483647
  • Next by thread: Re: NSString Retain Count of 2147483647
  • Index(es):
    • Date
    • Thread