• 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: CALayer retain count
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: CALayer retain count
      • From: Shaun Larkin <email@hidden>
References: 
 >CALayer retain count (From: Shaun Larkin <email@hidden>)

  • Prev by Date: Re: Design Question: Pro & Cons of KVC/KVO
  • Next by Date: 10.4+ NSNumberFormatter in IB3 question
  • Previous by thread: Re: CALayer retain count
  • Next by thread: Re: CALayer retain count
  • Index(es):
    • Date
    • Thread