PineApps
PineApps

Reputation: 43

Instruments reporting memory leak whenever AVSpeechSynthesizer is used to read text

Everytime I use AVSpeechSynthesizer to speak text Instruments reports a memory leak in the AXSpeechImplementation library. Here's the code I'm using to make the call:

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

Here's the link to the Instruments screenshot http://imageshack.com/a/img690/7993/b9w5.png

Upvotes: 3

Views: 1158

Answers (2)

Bradley Fischer
Bradley Fischer

Reputation: 51

I solved this by declaring the AVSpeechSynthesizer as a global variable

static let synth = AVSpeechSynthesizer()

Upvotes: 3

Ali Beadle
Ali Beadle

Reputation: 4516

For what it is worth - yes, I see exactly the same 16byte leak on every utterance from the speech synthesizer. So either it is a leak in Apple's code or we are both making the same error somewhere!

Ali

Upvotes: 7

Related Questions