Try this
http://www.scitech.se/memp
Main Topics
Browse All TopicsI have a CPU creep problem in my application and don't know how to troubleshoot it. What happens is I will start up the app and turn on perfmon looking specifically at the CPU utilization of the application process and thread count. The app will start off using about 10% CPU and 8-10 threads. It gradually increases its load on the CPU and thread consumption over the course of about 60 mins after which time it is using 100% CPU and 60 threads. I have to suspect that this is some how related to the multithreading but have no idea how to look at what part of the app is causing the CPU creep. This is my first serious multithreaded app and i'm really at a loss. I will award points for ideas about how to investigate the problem because it doesn't seem likely that anyone will be able to tell me what line of code is causing the problem... ;-) Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Try this
http://www.scitech.se/memp
It's never very easy to debug... the way I would approach it is to break the app into smaller pieces.. write out log / trace messages at each thread start / stop and probably with every other line of code..
In a well synchronized world any amount of thread contention should be avoided (but may not always be feasible).
Took a look at the Contention Rate/sec. It starts at about 1/sec and then after a while the couter increments with larger numbers. It is at that point that the CPU starts to take off so it seems pretty reasonable to conclude that the two are related. When you posted earlier you talked about writing trace messages when threads start/stop. What information would be useful and should be included in the trace messages? Contention is where multiple threads want to use a global variable correct? there is only one situation where i use synclock in the app so I assume that has to be the source of the problem. I tried to implement it using the smallest "footprint" possible. Can you offer some advice on how to structure the synclocks? Or possibly an alternative? I am using Synclock to batch some SQL together and have included a code snipet below. Thanks!
SyncLock BatchSQL
BatchSQL.Append(strSQL)
BatchSQL.Append(";")
BatchSQLCount += 1
If BatchSQLCount >= 250 Then
'If the SQL batch is big enough then copy the batch to a temp string variable and clear the global string variable
SQLTemp = BatchSQL.ToString
BatchSQL.Remove(0, BatchSQL.Length)
BatchSQLCount = 0
ExecuteBatch = True
End If
End SyncLock
I took a look at the .net memory profiler. I am new to the multithreading scene so it is taking me a while to understand what I am looking at. What I think I have discovered is that a class I am creating to pass data to a thread is not being freed after the thread is finished. So the question I think that I want to ask is how do I make sure that I have properly "disposed" of a class that has been used to send data to a thread after the thread has completed its job?
Business Accounts
Answer for Membership
by: sj_hicksPosted on 2004-09-19 at 23:13:50ID: 12099601
Process Explorer from http://www.sysinternals.co m give lots of info about running processes such as threads, handles etc. This might be helpful.