• 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: Still can't figure out this overrelease bug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Still can't figure out this overrelease bug


  • Subject: Re: Still can't figure out this overrelease bug
  • From: Eric Brunstad <email@hidden>
  • Date: Sat, 11 Jun 2005 11:51:01 -0400

Hi,

Try using NSExtraRefCount() to get the reference count of an object at a specific point.  This will help you to find the lifespan of an object.

Eric Brunstad
Mind Sprockets Software
email@hidden
www.mindsprockets.com

On Jun 11, 2005, at 8:30 AM, Theodore H. Smith wrote:

OK, well hows about this. If I use NSAutoReleasePool well enough, maybe I can pin this bug down?

I've never done this before, though, it just seems like it might be possible, from what I read. I'm not exactly sure yet on what additional bugs I might create by (badly) using NSAutoReleasePool.

Let's say I had this code:

NSAutoReleasePool* p = [[NSAutoReleasePool alloc]init];
NSString* s = [NSString stringWithCString : "hello"];

[p drain];
[self doStuffWith : s]; // crash.
[p release]; // we never get here

Something like that would a bug introduced by badly using NSAutoReleasePool, right?

Then the problem becomes finding out which references to NSObjects I have for which lifetimes.

Let's (very theoretically) say then that I am able to perfectly figure out the lifetime of every NSObject I have.


NSAutoReleasePool* p = [[NSAutoReleasePool alloc]init];
NSString* s = [NSString stringWithCString : "hello"];

[s autorelease]; // over released!
[self doStuffWith : s];
[p drain]; // crash.
[p release];

Would that then help me pin down my bug, by making the crash closer to the point where I overrelease?

 _______________________________________________
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

References: 
 >Re: Still can't figure out this overrelease bug (From: "Theodore H. Smith" <email@hidden>)
 >Re: Still can't figure out this overrelease bug (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: Fullscreen code not working (code revisions)
  • Next by Date: Re: Still learning about NSAutoReleasePool
  • Previous by thread: Re: Still can't figure out this overrelease bug
  • Next by thread: Re: Still can't figure out this overrelease bug
  • Index(es):
    • Date
    • Thread