Why tiny memory leak in this func related to UIGraphicsBeginImageContext?-Collection of common programming errors
I have a simple function to create an UIImage with special size :
- (UIImage*)imageWithSize:(CGSize) imSize
{
UIGraphicsBeginImageContext( imSize );
float r = 0.5f;
float g = 0.5f;
float b = 0.5f;
CGContextRef cxt = UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(cxt, r, g, b, 1.0);
CGContextSetRGBFillColor(cxt, r,g,b, 1.0);
CGContextFillRect(cxt, CGRectMake(0.0, 0.0, imSize.width, imSize.height));
UIImage* retImg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return retImg;
}
and then I call it MANY times in this way (I’m using ARC):
for(int i=0;i