I am trying to export video with some parameters like video bit rate, audio bit rate, frame rate, changing video resolution, etc. Note that I am letting the user set the video frame rate in fractions; like user can set the video frame rate say, 23.98.
I use AVAssetWriter and AVAssetReader for this operation. I use AVAssetWriterInputPixelBufferAdaptor for writing the sample buffers.
Everything else works just fine, except: the video frame rate.
我知道这个问题与内存分配有关,但我只在iOS 9,XCode 7中得到它.在XCode 6.4,iOS 8.4中,它工作得很完美,在任何方面都没有问题.在iOS 9,XCode 7中,它只是经常崩溃而产生此错误.
malloc: *** mach_vm_map(size=1048576) failed (error code=3)
*** error: can't allocate region securely
*** set a breakpoint in malloc_error_break to debug
有什么建议?我正在处理内存问题,但我想知道是否存在太多内存问题,那么为什么它在iOS 8.4中工作而在iOS 9中不起作用?
另外,我把所有的UI都搞砸了!就像导航栏没有标题一样,自定义标签栏(RDVTabBar)不可见,但是,其他视图控制器就在那里(它响应触摸事件,您可以点击该区域,并且位于该区域的按钮起作用!).
PS我没有得到内存警告,也没有applicationWillTerminate:调用任何方法!
更新:我发现此问题仅发生在iPhone 5和4s中!(非64位设备!)
更新2:当崩溃发生时,我尝试打印其中一个对象并打印它,我再次在调试模式下得到相同的错误:
malloc: *** mach_vm_map(size=1048576) failed (error code=3)
*** error: can't allocate region securely
*** set a breakpoint in malloc_error_break to debug.
------------------更新------------------
好吧,我在这里找到了一些东西:我在仪器中检查了我的应用程序并检测到它在iOS 8.4中占用了大约200mb的内存,而且令人惊讶的是iOS 9.*占用了1.5 GB的内存!这是我不明白的事情!一个应用程序在iOS 8.4中占用200 MB的内存,同一个应用程序在iOS 9上占用超过1.5GB的内存!根本不可理解!任何的想法?