?
Solved

500pts: CPU Utilization is really high in my app

Posted on 2006-10-30
3
Medium Priority
?
201 Views
Last Modified: 2010-04-16
Hi there,

I wonder if anyone can help, I am having some major issues with CPU utilization...

I have an app and basically it creates 24 reference types (objects) and stores them in a hashtable... at this point utiilization is pratically 0

The next day I clear out the hashtable which I presume will destroy the references as when i added them they they were local reference variables   to  a class. I use the method .Clear and then i recreate local variables of the 24 reference types (classes) and readd them to the Existing hashtable which of course is empty now...

At some point during this period .. the utilization creeps up to above 25%,,.,.

Should I be doing .dispose or somehting??

I really hope somebody can help, i am totally lost as to why it would be happening...

Thanks in advance

Ian

0
Comment
Question by:ianinspain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
der_jth earned 1000 total points
ID: 17835399
Memory leakage per se will not cause CPU utilization to rise. If you release all the resources to your objects, they will be collected. Sometimes you accidentally leave refs hanging around, but that doesn't cause a constant CPU pressure. Dispose will speed up releasing external resources (DB connections or similar ones), but for memory-only objects it isn't necessary.

I suggest you look for endless (or nearly so) loops. When the application is taking 25% CPU, attach a debugger and see where the code is. Helping you much more than that is pretty much impossible without seeing your source code.

0
 
LVL 6

Assisted Solution

by:Wayne Bradney
Wayne Bradney earned 1000 total points
ID: 17851496
The 25% figure is suspicious.
Is it always 25%?
Do you have a quad processor machine (or a dual-dual-core or dual HT machine)?
If so you're almost certainly looking at a tight-loop, as der_jth suggests, but it may not even be in your code. I've found tight-loops in Windows Forms UIs that bind user-defined types to components. If your type doesn't correctly report Equals and GetHashCode results, some components can constantly invalidate/revalidate areas of the screen because they think that the value of the bound variable has changed.
0
 

Author Comment

by:ianinspain
ID: 17864872
thanks both... yes it was a loop... thanks... for that..

ian
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question