Make CVDisplayLink + Automatic Reference Counting play well together <p>I recently switched from using NSTimer to CVDisplayLink to redraw my OpenGL animation, but i've got a little problem making it work with ARC switched on:</p> <pre><code>/* * This is the renderer output callback function. */ static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* displayLinkContext) { // now is the time to render the scene [((__bridge BDOpenGLView*)displayLinkContext) setNeedsDisplay:YES]; // always succeeds, because we don't actually do anything here anyway return kCVReturnSuccess; } </code></pre> <p>The display link callback function has to be written in C, to be used as a parameter for</p> <pre><code>// set the renderer output callback function CVDisplayLinkSetOutputCallback(displayLink, &amp;displayLinkCallback, (__bridge void*)self); </code></pre> <p>So i can't use <code>self</code> within in the callback, but using <code>((__bridge BDOpenGLView*) displayLinkContext)</code> produces a memory leak:</p> <pre><code>objc[29390]: Object 0x1001b01f0 of class NSConcreteMapTable autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug </code></pre> <p>I read, that i have to set up an <code>NSAutoreleasePool</code> myself, but i can't with ARC switched on.</p> <p>Am i missing something?</p>