Q:

CVOpenGLESTextureCacheCreateTextureFromImage reporting "Failed to create IOSurface image (texture)"

Can anyone explain (or point out the relevant FM covering) this function?
iPad 2, iOS 5.0.0, Xcode 4.2, project with ARC.
My project takes input from the camera and mixes it with various images, finally rendering it all on the screen.
As long as I don't get a memory warning, it works fine indefinitely with no memory leaks.  
After a didReceiveMemoryWarning, the first 5 times this function is called it fails saying "Failed to create IOSurface image (texture)". After that, the screen goes black and the program stops responding. I can press the home key and then kill the app.
My call looks like this:
    err = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault, 
                                                   _videoTextureCache,
                                                   pixelBuffer,
                                                   NULL,
                                                   GL_TEXTURE_2D,
                                                   GL_RED_EXT,
                                                   _textureWidth,
                                                   _textureHeight,
                                                   GL_RED_EXT,
                                                   GL_UNSIGNED_BYTE,
                                                   0,
                                                   &_lumaTexture);

_videoTextureCache is originally created with this:
    //-- Create CVOpenGLESTextureCacheRef for optimal CVImageBufferRef to GLES texture conversion.
    CVReturn err = CVOpenGLESTextureCacheCreate(kCFAllocatorDefault, NULL, (__bridge void *)_context, NULL, &_videoTextureCache);
    if (err) 
    {
        NSLog(@"Error at CVOpenGLESTextureCacheCreate %d", err);
        return;
    }

_videoTextureCache is defined like this:
CVOpenGLESTextureCacheRef _videoTextureCache;    

Do I need to call something to release allocated memory when I get a memory warning?
Can I nil _videoTextureCache (so ARC can clean up memory), and then recreate it?
The only documentation I've found so far is comments in the .h where the function is declared, and that doesn't really seem to help.
Anyone know of other documentation?
-Ken

A:

Are you calling CFRelease() on your CVOpenGLESTextureCacheRef and CVOpenGLESTextureRef when you don't need them anymore?
Apple Source Code:

GLCameraRipple
RosyWriter

