AVAudioRecorder Memory Leak

半世苍凉 提交于 2019-12-03 22:15:33

I don't see anything and if Clang doesn't find a leak in your code your code is unlikely to be at fault. It looks like a leak in the framework.

I wouldn't sweat it. A 16 byte leak when the user presses stop isn't likely to cause problem. You would have to stop thousands of recordings before the accumulated leaks grew large enough to cause problems. Small leaks are only a concern when they are rapidly repeated such as in a large loop.

It's annoying and aesthetically repellent to leave a known leak but time is money and I wouldn't waste either on this unless you know it is a significant problem.

I'm pretty sure I can back you up on this. I just haven't had time to file a bug report. I get the same leak. It usually is 256 bytes if I do Apple lossless format, but reduces itself to 48 bytes if I use AAC.

I spent 3 hours testing and trying to comment out different code. Nothing was absolutely reproducible, although I could pretty much get it to leak almost every time. If I took out some code after the "stop" message, I could usually get it to not leak. Basically, when I had a bunch of logic/crunching/processing going on immediately after doing the stop, it would leak. If I just commented out all the code after that, it wouldn't leak (usually).

I also tried other things like changing the recording settings (different qualities, bitrates, etc) and again, nothing too predictable to form any scientific conclusions.

I know this post is a year old, but it's still not fixed as far as I can see.

I'm getting the same issue, both in the Simulator and on the device. 48 bytes are being leaked, as soon as I stop the AVAudioRecorder.

The method that is leaking is:

closeFile(AVAudioRecorder*,AudioRecorderImpl*)

Here is a screenshot of a profiling session done with the App running on a device, running iOS 4.3.x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!