仪器在使用AVSpeechSynthesizer读取文本时报告内存泄漏

问题描述 投票:3回答:2

[每次我使用AVSpeechSynthesizer说话时,Instruments都会在AXSpeechImplementation库中报告内存泄漏。这是我用来拨打电话的代码:

AVSpeechUtterance *speak = [AVSpeechUtterance speechUtteranceWithString:text];
speak.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];
speak.rate = AVSpeechUtteranceMaximumSpeechRate * .2;
[m_speechSynth speakUtterance:speak];

这里是Instruments屏幕截图的链接http://imageshack.com/a/img690/7993/b9w5.png

memory-leaks ios7 avfoundation avspeechsynthesizer
2个回答
4
投票

对于它的价值-是的,我发现语音合成器在每次发声时都会看到完全相同的16byte泄漏。因此,要么是苹果代码泄漏,要么我们都在某个地方犯了同样的错误!

Ali


0
投票

我通过将AVSpeechSynthesizer声明为全局变量来解决此问题

static let synth = AVSpeechSynthesizer()
© www.soinside.com 2019 - 2024. All rights reserved.