Hi everybody!
I've got a memory leak i just don't know how to solve.
This is the leaking code:
[newImg release];
CGColorSpaceRef d_colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(Data, width,
height,
8, 4*width,
d_colorSpace,
kCGImageAlphaNoneSkipFirst);
UIGraphicsPushContext(context);
CGImageRef new_img = CGBitmapContextCreateImage(context);
UIImage * convertedImage = [[UIImage alloc] initWithCGImage:
new_img];
CGImageRelease(new_img);
CGContextRelease(context);
CGColorSpaceRelease(d_colorSpace);
newImg = convertedImage;
I modify pixel information stored in Data, then with this method i create a UIImage back from the Data (which is as unsigned char array)
The xcode instruments tells me that there are leaks in here:
CGImageRef new_img = CGBitmapContextCreateImage(context);
And here:
UIImage * convertedImage = [[UIImage alloc] initWithCGImage:
new_img];
though i release both of them :( Can somebody tell me how to solve this?
Thanks in advance ^-^