开发者

.Net: I got the following exception InteropServices.COMException: "No more threads can be created in the system."

开发者 https://www.devze.com 2023-03-10 03:32 出处:网络
I have .Net application which communicates with some COM object, and I got the following exception in the COM:

I have .Net application which communicates with some COM object, and I got the following exception in the COM: System.Runtime.InteropServices.COMException (0x800700A4): No more threads can be created in the system. (Exception from HRESULT: 0x800700A4)

Does it mean开发者_如何学Pythons that the COM object created too many threads (as far as I know the threads limit is for process) or that there are too many threads in Windows (maybe too many handles)? Or who's responsible for the failure, my system, or the COM object?


The root cause for this issue was that the COM object was creating a new thread for each call, resulting in resource likage.
This article (archived version) explains the threads limit issue:
"Because each thread consumes part of a process’s address space, processes have a basic limit on the number of threads they can create that’s imposed by the size of their address space divided by the thread stack size."

0

精彩评论

暂无评论...
验证码 换一张
取 消