Search code examples
iphonememory-managementcore-graphicsquartz-graphicsquartz-2d

Do I have a memory management problem in here?


Something must be wrong with this code right here:

+ (UIImage*)captureView:(UIView *)theView {
    UIGraphicsBeginImageContext(theView.frame.size);
    [theView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}

When I use that, Xcode throws me this error message:

malloc: * error for object 0x103f000: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug

I can't see any memory management errors there. Does anyone else?


Solution

  • I had the same warning. But, it does not occur in 3.1 or above.