?
Solved

500pts: CPU Utilization is really high in my app

Posted on 2006-10-30
3
Medium Priority
?
205 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
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Loops Section Overview
Suggested Courses

850 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