Re: CALayer retain count
Re: CALayer retain count
- Subject: Re: CALayer retain count
- From: "Shawn Erickson" <email@hidden>
- Date: Thu, 21 Aug 2008 08:27:51 -0700
On Thu, Aug 21, 2008 at 7:06 AM, Shaun Larkin <email@hidden> wrote:
> Why is it that when you set a CALayer property it's retain count increases +1 ?
>
> eg.
>
> CALayer * testLayer = [[CALayer alloc] init];
> NSLog(@"test layer retain count:: %i", [testLayer retainCount]);
> testLayer.frame = CGRectMake(0, 0, 30, 30);
> NSLog(@"test layer retain count:: %i", [testLayer retainCount]);
>
> First log prints test layer retain count:: 1
> Second log prints test layer retain count:: 2
Why are you looking at retain counts? They will often mislead you
because of temporary retains that will be balanced at some point in
the future by a release messages (autorelease).
Note that testLayer.frame = ... is the same as [testLayer
setFrame:...] so the setFrame method is causing something to do a
retain/autorelease of testLayer. It is an implementation detail.
-Shawn
_______________________________________________
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