我可以證實,此內存泄漏仍然存在,在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