好吧,我很难追踪这个内存泄漏。运行此脚本时,我没有看到任何内存泄漏,但我的 objectalloc 正在攀升。Instruments 指向 CGBitmapContextCreateImage > create_bitmap_data_provider > malloc,这占了我的 objectalloc 的 60%。
这段代码被一个 NSTimer 调用了几次。
退货后如何清除reUIImage?
...或者我怎样才能使 UIImage imageWithCGImage 不构建我的 ObjectAlloc?
//I shorten the code because no one responded to another post
//Think my ObjectAlloc is building up on that retUIImage that I am returning
//**How do I clear that reUIImage after the return?**
-(UIImage) functionname {
//blah blah blah code
//blah blah more code
UIImage *retUIImage = [UIImage imageWithCGImage:cgImage];
CGImageRelease(cgImage);
return retUIImage;
}