Solved

500pts: CPU Utilization is really high in my app

Posted on 2006-10-30
3
200 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 250 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 250 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

726 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