AVSpeechSynthesizer leaks memory heavily on iOS 13.

Originator:mseriukov
Number:rdar://7439807 Date Originated:2019-11-08
Status:Open Resolved:
Product:AVFoundation Product Version:iOS 13
Classification:Bug Reproducible:Always
 
If AVSpeechSynthesizer had spoken at least one utterance it never deallocates on iOS 13.0-13.2
Please see the attached demo project. It works ok on iOS 12.* but leaks on iOS 13 about 10MB per AVSpeechSynthesizer instance.

Code from the demo project to reproduce: 

import UIKit
import AVFoundation

class ViewController: UIViewController {
    private var timer: Timer?
    private var synth = AVSpeechSynthesizer()

    override func viewDidLoad() {
        super.viewDidLoad()
        timer = Timer.scheduledTimer(timeInterval: 1, target: self,   selector: (#selector(ViewController.tick)), userInfo: nil, repeats: true)
    }

    @objc
    func tick() {
        synth = AVSpeechSynthesizer()
        synth.speak(AVSpeechUtterance(string: "test"))
    }
}

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!