Solved

500pts: CPU Utilization is really high in my app

Posted on 2006-10-30
3
196 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 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:wbradney
wbradney 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now