In my ipad application i am using UIGraphicsGetImageFromCurrentImageContext(), the memory increases very high and the app crashes sometime. Code is given below
UIImage * blendImages(UIImage *background, UIImage *overlay)
{
UIImageView* imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 1024.0,700.0)];
UIImageView* subView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 1024.0,700.0)];
subView.alpha = 1.0;
[imageView addSubview:subView];
imageView.image=background;
subView.image=overlay;
UIGraphicsBeginImageContext(imageView.frame.size);
[imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage* blendedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[subView release];
[imageView release];
return blendedImage;
}
The method blendImages is called with in a loop and i had given autorelease pool I have seen similar questions asked , related to memory hike when using UIGraphicsGetImageFromCurrentImageContext() , but unfortunately no proper answer , Any help please ..?????