Re: CALayer retain count
Re: CALayer retain count
- Subject: Re: CALayer retain count
- From: Shaun Larkin <email@hidden>
- Date: Thu, 21 Aug 2008 08:32:45 -0700 (PDT)
thanks for the answer!
--- On Thu, 8/21/08, Shawn Erickson <email@hidden> wrote:
> From: Shawn Erickson <email@hidden>
> Subject: Re: CALayer retain count
> To: email@hidden
> Cc: email@hidden
> Received: Thursday, August 21, 2008, 11:27 AM
> 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
__________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at
http://ca.toolbar.yahoo.com.
_______________________________________________
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