Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8171847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:35:32+00:00 2026-06-06T21:35:32+00:00

I found a continuous leakage in my application. After examining using a memory profiler,

  • 0

I found a continuous leakage in my application. After examining using a memory profiler, I found the course is some object from Microsoft Speech.Synthesizer

So I build up a toy project to verify the hypothesis:

//Toy example to show memory leak in Speech.Synthesizer object

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"));

    //tts.Dispose();    //also this doesn't work as well
    //tts = null;

    GC.Collect();   //a little help, but still leaks
}
}

And the result actually confirmed the memory leak is from Speech.Synthesizer

Speaking...

Memory: 42184 KB

Speaking…
Memory: 42312 KB

Speaking…
Memory: 42440 KB

Speaking…
Memory: 42568 KB

Speaking…
Memory: 42696 KB

Speaking…
Memory: 42824 KB

Speaking…
Memory: 43016 KB

Speaking…
Memory: 43372 KB

I googled it and found many others have come across the same problem:
1:
Constant Memory Leak in SpeechSynthesizer
2:
http://connect.microsoft.com/VisualStudio/feedback/details/664196/system-speech-has-a-memory-leak

but sadly I didn’t find any solution to it. Since its a problem already asked long time ago, so I want to ask if its been solved or not?

Many Thanks.

UPDATE:

Seems like while I switch to use SAPI COM dll rather than .Net Speech.Synthesizer package (although essentially they are the same thing), the memory stops leaking.

Why is the two invoke behavior (SAPI dll vs .net Speech package) have different memory behavior? As the latter seems is just a wrapper to the former SAPI dll.

    static void Test2()
{
    //SAPI COM component this time
    SpeechLib.SpVoiceClass tts = new SpeechLib.SpVoiceClass();
    tts.SetRate(5);
    string text = "hello world. This is a long sentence";
    //tts.Speak("helloWorld", SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault);
while (true)
{

    Console.WriteLine("Speaking...");
    tts.Speak(text, SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault);

    //Print private working set sieze
    Console.WriteLine("Memory: {0} KB\n", (Process.GetCurrentProcess().PrivateMemorySize64 / 1024).ToString("0"));

    GC.Collect();
}

}

Memory: 32044 KB

Speaking…
Memory: 32044 KB

Speaking…
Memory: 32044 KB

Speaking…
Memory: 32044 KB

Speaking…
Memory: 32044 KB

Speaking…
Memory: 32044 KB

Speaking…
Memory: 32044 KB

Speaking…
Memory: 32044 KB

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:35:33+00:00Added an answer on June 6, 2026 at 9:35 pm

    Final solution:

    Google-ing relevant keywords telling me that it’s actually a bug from Microsoft.

    Seems like while I switch to use SAPI COM dll rather than .Net Speech.Synthesizer package (although essentially they are the same thing), the memory stops leaking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT After some more research I found that I cannot use a continuous form
I want to exclude some tests from my continuous integration build but I haven't
We have a WPF application and we are using TFS 2010 for continuous integration.
I'm using Mercurial for personal use and am conteplating it for some distributed projects
I asked some time ago for help getting continuous integration working in Delphi previously.
I'm new to using continuous integration and have decided to go with TeamCity. One
I'm currently using jenkins/hudson for continuous integration a large mostly C++ project. We have
I have been developing a GUI for reading continuous data from a serial port.
I want to use some animation in my page,so I google "javascript animation",I found
In our continuous integration process we are using Aspnet compiler to publish the source.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.