Hello
Thank you for posting in Microsoft Community forum.
I’m sorry to hear that you’re experiencing a memory leak issue with Microsoft.Speech.Recognition
. I can help you with some general tips that might help you resolve the issue.
According to a stack over flow post, the memory leak issue you’re experiencing is a known problem with Microsoft.Speech.Recognition
and System.Speech.Recognition
. The recognition engine grows in memory while it runs in a separate thread, and disposing of the engine at the end of the execution does not resolve the issue. The memory growth is evident even with correct disposal practices.
One possible solution is to use the SpeechRecognitionEngine
class instead of Microsoft.Speech.Recognition
or System.Speech.Recognition
. The SpeechRecognitionEngine
class is part of the System.Speech
namespace and is designed to work with the .NET Framework 4.0 and later versions. It is recommended to use this class instead of the other two classes.
Another possible solution is to use the PushStream
class instead of the MemoryStream
class. According to a GitHub issue, the memory leak issue is observed when more than two PushStream
instances are used, and it gets worse as more PushStream
instances are added. This would suggest that some shared memory managed by the SDK grows as PushStream
instances are used.
I hope this information helps you resolve the issue. Let me know if you have any other questions or concerns.
Best Regards,
Zack Lu