views:

114

answers:

2

I wrote a program that uses OLE and it was working fine until I added some components which were important for my program, after that my program have problem when starts to work with OLE and raise this exception:

    "EOleSysError
     No more threads can be created in the system"

is there any way to requesting more threads or free used threads or something like them? How can solve this problem? Thanks.

+7  A: 

I strongly suggest, either you stop using the components if you cannot fix them (tell the author to fix them), or you start using them correctly if the fault is on your side. Reaching the thread limit for a process is a serious issue and should never happen. There is no cure for that, but fixing the code that is causing it.

Read this: Pushing the Limits of Windows: Processes and Threads

Runner
I cant fix it, because its not open. Im sure fault is not on my side (before using this component everything was fine and by the way i did not coded any thread or threading way).
Armin
it was a very useful and interesting article, thank you
Armin
I strongly suggest you look for an alternative then. And an open one. I will not suggest finding some obscure workarounds because in my opinion in such cases there are none that would be acceptable. At least probably for 99% of the cases. But I feel your pain and I know in what kind of situation you are right now.
Runner
At least tell us which component that is and what it does, so we can recomend a replacament.
Runner
The component is our company internal component which is written by previous programmers and they are not available. This is an CAD component.
Armin
Then sadly you are in a bad situation. Never buy or maintain components without code. The resons are clear in your case. If you cannot change the component you have only two options left. Get somebody to write a new one or make a workaround. About workarounds, I already told my opinion. The third option is maybe to make a workaround until a new solution can be made. You buy time this way. You can maybe terminate old or idle threads. But as I said this are very bad solutions and may have very unpredictable results.
Runner
+1  A: 

Maybe you use those components in a bad way? So those components keep connections and threads open instead of closing them?

What kind of components do you use? And how, do you have some example code?

André