• 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: [pool release] error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pool release] error


  • Subject: Re: [pool release] error
  • From: Steve Wetzel <email@hidden>
  • Date: Fri, 26 Dec 2008 11:41:53 -0600

Thanks for the info Dave,

How do you know that number with Integer creates an autoreleased object? I do not see that in the documentation. As also mentioned in a reply, decimalNumberByDividingBy does not have a retain count either. I am new to mac programming but I do not see this in the documentation.

Steve
On Dec 26, 2008, at Dec 26:10:41 AM, Dave Carrigan wrote:


On Dec 26, 2008, at 8:29 AM, Steve Wetzel wrote:

-(void)setNumerator:(NSInteger)n {
	[numerator release];
	numerator = [NSNumber numberWithInteger:n];

+numberWithInteger creates an autoreleased object. You are also releasing numerator explicitly in your -dealloc method, so when you release the pool, numerator will get released a second time. Either retain numerator or use alloc/init.


[pool release];

You should generally use [pool drain] instead of release. It doesn't matter here, but if you get in the habit of using -drain instead of - release, then when it does matter, you will already be covered.

_______________________________________________

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: [pool release] error
      • From: Bill Bumgarner <email@hidden>
References: 
 >[pool release] error (From: Steve Wetzel <email@hidden>)
 >Re: [pool release] error (From: Dave Carrigan <email@hidden>)

  • Prev by Date: Re: Quartz compoziton colors not good in Cocoa App
  • Next by Date: Re: [pool release] error
  • Previous by thread: Re: [pool release] error
  • Next by thread: Re: [pool release] error
  • Index(es):
    • Date
    • Thread