我可以证实,此内存泄漏仍然存在,在iOS 9.2。 (我也发布在Apple Developer Forum上。)
我在iOS 9.2上得到了相同的内存泄漏。我测试了使用MetalKit和MLKDevice来删除EAGLContext。我已经测试过使用CIContext的不同方法,如drawImage,createCGImage和render,但似乎没有任何工作。
很明显,这是iOS 9以来的一个bug。通过从Apple下载示例应用程序(请参见下文)尝试一下自己,然后在iOS 8.4的设备上运行相同的项目,然后在iOS 9.2的设备,并注意Xcode中的内存量表。
下载 https://developer.apple.com/library/ios/samplecode/AVBasicVideoOutput/Introduction/Intro.html#//apple_ref/doc/uid/DTS40013109
一下添加到APLEAGLView.h:20
@property (strong, nonatomic) CIContext* ciContext;
更换APLEAGLView。米:118与此
[EAGLContext setCurrentContext:_context];
_ciContext = [CIContext contextWithEAGLContext:_context];
而且finaly替换APLEAGLView.m:341-343与此
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
@autoreleasepool
{
CIImage* sourceImage = [CIImage imageWithCVPixelBuffer:pixelBuffer];
CIFilter* filter = [CIFilter filterWithName:@"CIGaussianBlur" keysAndValues:kCIInputImageKey, sourceImage, nil];
CIImage* filteredImage = filter.outputImage;
[_ciContext render:filteredImage toCVPixelBuffer:pixelBuffer];
}
glBindRenderbuffer(GL_RENDERBUFFER, _colorBufferHandle);
你运行了一个分配ns(仪器)查看泄漏的位置? – Aggressor
仪器中未显示泄漏。 – krafter
您如何以及在哪里测试?使用发布配置进行测试会导致误导性结果。模拟器上的测试会导致误导结果。 – matt