Tag: speech synthesis

.Net Speech.Synthesizer中的内存泄漏?

我在申请中发现了连续泄漏。 在使用内存分析器进行检查后,我发现该课程是来自Microsoft Speech.Synthesizer的一些对象 所以我建立了一个玩具项目来validation这个假设: //在Speech.Synthesizer对象中显示内存泄漏的玩具示例 static void Main(string[] args) { string text = “hello world. This is a long sentence”; PromptBuilder pb = new PromptBuilder(); pb.StartStyle(new PromptStyle(PromptRate.ExtraFast)); pb.AppendText(text); pb.EndStyle(); SpeechSynthesizer tts = new SpeechSynthesizer(); while (true) { //SpeechSynthesizer tts = new SpeechSynthesizer(); Console.WriteLine(“Speaking…”); tts.Speak(pb); //Print private working set sieze Console.WriteLine(“Memory: {0} KB\n”, (Process.GetCurrentProcess().PrivateMemorySize64 / 1024).ToString(“0”)); […]