开发者

Performance counters for current threads

I am building a .NET windows service which is using an unmanaged C++ dll. both of my service and the c++ dll are using multi threading. I am running out of memory after some time (hours) while processing. I tried to measure the number of threads using "Performance counters" and I monitors the following values:开发者_JAVA技巧

# of current logical Threads
# of current recognized threads
# of total recognized Threads

While the first one is steady and its value is reasonable the 2nd and the 3rd are not. they are always growing and reaching a huge number (over 1500). And they are equal !!!!

Should they be equal? I also didn't understand from this page if those counters will count both managed and unmanaged threads.

I suspect that the unmanaged code is alwayes launching new threads instead of reusing them, but I am not sure.

can anyone help? Thanks


Sounds like a leak. Most likely the unmanaged DLL is not properly disposing of it's threads.

In order to really test this write a single threaded app which uses that DLL. Monitor the app. If you notice it's not disposing of things properly, then you have one of two situations.

Either you aren't calling the correct methods in the DLL to close the resources (threads). Or the DLL is badly coded. The first one is easy to fix, the second one will require access to the source code or original developers.

If it is the DLL and you can't contact them or they are unwilling to fix, then find something else that does nearly the same thing.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜