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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to