English 中文(简体)
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:

# 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.

问题回答

暂无回答




相关问题
Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Is reading from an XmlDocument object thread safe?

I was wondering if i could safely read from an XmlDocument object using SelectNodes() and SelectSingleNode() from multiple threads with no problems. MSDN says that they are not guaranteed to be ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签