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
175 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
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…

920 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

14 Experts available now in Live!

Get 1:1 Help Now