Reputation: 1097
While debugging in instruments using 'ObjectAlloc' I'm noticing 7megs of memory being allocated for the renderInContext call, but it never is released. When I comment out the renderInContext call this doesn't happen, and future renderInContext calls does not continue to increase the memory allotment.
UIGraphicsBeginImageContext(contentHolder.bounds.size);
[contentHolder.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Is there a way to force this memory to be released?
Upvotes: 3
Views: 1442
Reputation: 170
I found out how to release the renderInContext memory. Simply run the method calling renderInContext on Main Thread and that will release the allocated memory automatically.
Upvotes: 1