views:

123

answers:

1

I am getting the message:

* _NSAutoreleaseNoPool(): Object 0x3f43660 of class UICFFont autoreleased with no pool in place - just leaking

I have placed a break point using the symbol _NSAutoreleaseNoPool and the program does break, however, the stack trace does not show me any of my code only some UIView and Core Animation layer code.

alt text

Is there a better way to get to the bottom of the issue? There is apparently a thread that does not have an auto release pool, but I can't figure out where.

Thanks.

+1  A: 

Are you using CATiledLayer instances ? This is the only type of layer I know that can have their drawLayer:inContext: method called from an arbitrary thread:

As more data is required by the renderer, the layer's drawLayer:inContext: method is called on one or more background threads to supply the drawing operations to fill in one tile of data. The clip bounds and CTM of the drawing context can be used to determine the bounds and resolution of the tile being requested.

Laurent Etiemble
Yes. I am using CATiledLayer.
Matt Long
So you must avoid using UI controls inside your layers; they don't like being called on a thread other than the UI thread. It is only safe to use Quartz2D functions (CGContextXXX, etc).If you really need to display UI controls, do it in a view.
Laurent Etiemble
You can't use any UIKit (or very few) classes inside the drawLayer:inContext: method. You'll need to use CG equivalents in order to use CATiledLayer.
Ashley Clark
The only UIKit class I am using is a UIImage. I'm calling [image drawInRect:] on it inside of drawLayer:inContext:. What's the alternative? Do I need to create the image outside of the drawLayer:inContext: and then simply call drawInRect in there?
Matt Long
If you have an UIImage, then a solution is to use CGContextDrawImage like this: CGContextDrawImage(ctx, rect, image.CGImage);
Laurent Etiemble