• 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
Leaking CGColor objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Leaking CGColor objects


  • Subject: Leaking CGColor objects
  • From: DKJ <email@hidden>
  • Date: Sun, 26 Oct 2008 07:25:06 -0700

I've got this in the init method of MyCALayer:

	self.foregroundColor =
		CGColorCreateGenericRGB( 1.0, 1.0, 0.9, 1.0 );

And in the controller I do this:

	[[MyCALayer alloc] init];
	[rootLayer addSublayer:myLayer];
	[myArray addObject:myLayer];
	[myLayer release];

Then later on this happens:

	for( id layer in myArray )
		[layer removeFromSuperlayer];
	[myArray removeAllObjects];

Instruments tells me I'm leaking CGColor objects whenever I call those methods in the controller.

So I've got some questions:

1. Is there such a thing as a CGColor class? I don't see it in the documentation; but "CGColor" is what Instruments lists as the leaked objects.

2. Are the CGColor objects being leaked when I remove MyCALayer objects from myArray? Should I set foregroundColor to nil when doing this?

3. Are sublayers retained when added to a superlayer? I'm assuming so, since they're kept in an array. But then they should be released by removeFromSuperView, so that shouldn't cause a leak.

dkj


_______________________________________________

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: Leaking CGColor objects
      • From: "Clark Cox" <email@hidden>
    • Re: Leaking CGColor objects
      • From: Antonio Nunes <email@hidden>
    • Re: Leaking CGColor objects
      • From: DKJ <email@hidden>
  • Prev by Date: [Resolved] Re: class method called on an instance
  • Next by Date: Re: Leaking CGColor objects
  • Previous by thread: [Resolved] Re: class method called on an instance
  • Next by thread: Re: Leaking CGColor objects
  • Index(es):
    • Date
    • Thread