On Mar 8, 2011, at 12:24, John Link wrote:

> NSNumber *myNum = [[NSNumber alloc] init];
> myNum = [prefs valueForKey:MinimumValue]; // retrieve NSNumber from shared 
> defaults
> // do stuff
> [myNum release];
> 
> I thought I was releasing the NSNumber I had created, but if I understand 
> correctly the second line just points myNumber at the autoreleased value 
> returned from valueForKey. So in addition to the overrelease caused by the 
> last 
> line, the NSNumber I originally created is orphaned, right? 

Right. :)

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to