views:

297

answers:

1

I am using CGImageCreateWithImageInRect() for generating a small image from a background image runtime, which is going to displayed for every thread call (0.01 sec). Once I start showing part of image through CGImageCreateWithImageInRect application starts consuming memory in very high rate and crashes within seconds. Memory consumed goes to 20+ MB and crashes. Normal application would run on 2MBs.

Image1 = CGImageCreateWithImageInRect(imageRef, CGRectMake(x, y, w, h));

and after processing I do

CGImageRelease(Image1);

but it is not helping me.

I want to know how to release memory associated with CGImageCreateWithImageInRect.

+3  A: 

The answer to your question is in fact CGImageRelease; the pair of lines you have excerpted from your code are correctly balanced. You must be leaking somewhere else.

smorgan