Rendering CALayer in context uses large amounts of memory
        Posted  
        
            by 
                Otium
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Otium
        
        
        
        Published on 2012-03-28T05:23:48Z
        Indexed on 
            2012/03/28
            5:29 UTC
        
        
        Read the original article
        Hit count: 184
        
I am taking a snapshot of a UIWebView layer, but when I render the webview's layer in the current context my app uses 10mb more memory, and I don't think that should be right. Here is my current code:
CGSize imageSize = self.bounds.size;
UIGraphicsBeginImageContextWithOptions(imageSize, YES, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
[self.layer  renderInContext:context];
_snapshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
        © Stack Overflow or respective owner