Hi, im trying to cut a image and mask it....that im able to do successfully..but the program exits after few minutes with 101 status
- (void) maskImage {
if(scopeOn==1){
UIGraphicsBeginImageContext(self.bounds.size);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
cachedImage=[UIImage imageNamed:@"loop.png"];
cachedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
imageRef = [cachedImage CGImage];
subImage = CGImageCreateWithImageInRect(imageRef, CGRectMake(scopeLoc.x-25, scopeLoc.y-25, 50, 50));
xMaskedImage = CGImageCreateWithMask(subImage, mask);
zoomImg.image = [UIImage imageWithCGImage:xMaskedImage]; // retImage;
[zoomImg setCenter:scopeLoc];
[self addSubview:zoomImg];
CGImageRelease(subImage);
CGImageRelease(xMaskedImage);
}
}
this is the code that im using....since im not allocating explicit memory my guess is that CGImageCreateWithImageInRect function is allocating memory but it is not being released...this function is called after every 0.1 secs...so eventually a large amount of memoey is allocated(i have seen this in memory leak performance monitor)
So is there any other way in which i can achive the same wihtout this function??