Solved

Font and Color Dialogs intermittently take an exceptionally long time to display on certain user machines.  Any idea why?  I cannot reproduce locally.

Posted on 2004-08-31
5
174 Views
Last Modified: 2013-12-03
I have a charting application that has many users.  Why viewing a chart, they can right-click and choose the preferences option to launch another form that is shown modally to modify the parameters of the chart.  On this new form there are many buttons for modifying the colors and fonts of the chart.  When they click on one of these buttons, I simply show a Color(or Font) Dialog with simple code:

ColorDialog dlg  = new ColorDialog();
dlg.Color = (Some Default Color);
dlg.ShowDialog();
Color result = dlg.Color;

A user called this morning and said it was taking between 6-10 minutes for the dialogs to reveal themselves.  The moment he clicked the button to launch the above code he was no longer able to touch any of the charts, receiving a beep in complaint, as though the Color dialog was visible (shown modally).  He simply had to wait it out and respond to the dialog.  He also said he received similar delays with the Font dialog.  Again, it is only 'some' users and only 'some' times.  This user does not always experience this issue.

Any ideas would be helpful, I dont see anything I can change.


**UPDATE**

The same user has informed me that even MessageBox dialogs are taking extended amounts of time to display.

**END UPDATE**
-Eric
0
Comment
Question by:ericdotnet
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
petoskey-001 earned 500 total points
ID: 11983373
It sounds like the disk is thrashing.  On computers with not enough ram, windows will swap out the currently running memory to the hard drive and then bring it back from the hard drive to real memory.  It does this transparently so programs don't notice, but users sure do.  I would suggest your client buy more ram.

As far as your code, it's late so I can't think right now what you would check.  
0
 
LVL 7

Expert Comment

by:petoskey-001
ID: 11983374
oh Yeah, is it limited to just your program?  My guess is it happens to most programs of similar size, or when running several applications on his computer.
0
 

Author Comment

by:ericdotnet
ID: 11984444
It is just my program, but the program _does_ take huge amounts of ram - half a gig or so (it pulls market data from many financial exchanges).  I'll have him upgrade his ram and see if that resolves it.
0
 

Author Comment

by:ericdotnet
ID: 12146448
petoskey-001, you had it right.  It turns out that GDI+ objects are not truly managed objects and they need to be explicitely disposed of.  I was not doing this and they were eating up all of the systems ram and filling up the page files, hence the slow dialogs.  Thanks for helping me find the bug! :)
0
 
LVL 7

Expert Comment

by:petoskey-001
ID: 12147002
Ah, The wonders of C#.  It's a nice language, but to do anything low level or you end up falling back on your C skills.  Glad to hear you found the problem.  
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to get a file from SqlServer DB 4 29
How to compare two table schema using c#? 6 32
Exception in Log4Net 1 18
Data Saving 5 24
Article by: Ivo
Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

12 Experts available now in Live!

Get 1:1 Help Now