Leaking CGColor objects
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