Application takes a long time to open a dialog after some time

N

nagar

I noticed this behavior in a C# application. For its nature the
applications stays mainly minimized to the tray icons
As soon as it's launched the application responds normally. After a
while, when I double click on the tray icon to show the window or I
type a shortcut to open a new dialog (which also contains third-part
controls) it takes much longer to open (even 3-5 seconds).

How is that? Is there a way to avoid this behavior and keep the
application always prompt.

Thanks.
Andrea
 
J

Jon Skeet [C# MVP]

I noticed this behavior in a C# application. For its nature the
applications stays mainly minimized to the tray icons
As soon as it's launched the application responds normally. After a
while, when I double click on the tray icon to show the window or I
type a shortcut to open a new dialog (which also contains third-part
controls) it takes much longer to open (even 3-5 seconds).

How is that? Is there a way to avoid this behavior and keep the
application always prompt.

How long is "a while"? If you're talking an hour or so when the
application hasn't been used, it's probably been swapped to disk. I
don't know any way round that.
 
P

Peter Duniho

How long is "a while"? If you're talking an hour or so when the
application hasn't been used, it's probably been swapped to disk. I
don't know any way round that.

Well, there are ways to keep the application in physical memory, but it's
not wise to do so in most situations. :)
 
V

VJ

Just put up a display message or notification like Outlook does ( idea is
from Outlook, but I guess its different issue).. We have done that to
indicate saying App is trying to load again, or a message indicate that...


VJ
 
N

nagar

But is the delay a problem of .NET or Windows application in general?
Maybe some assemblies gets unloaded and then reloaded again. Are there
any situations which may increase this delay?
Thanks.
Andrea
 
V

VJ

Is it slow after how long, like Peter / Jon said. If its longer than 1 hour
than it goes to disk.

Yours is more like application goes to disk probably, and you need to
maintain in physical memory. Please don't do that, not a good idea. Best
would be to display a message and let the windows take care of it.

Also in the case if you have expensive operation on Application load, when
it goes to disk, coming out back will be slow.

VJ
 
J

Jon Skeet [C# MVP]

But is the delay a problem of .NET or Windows application in general?

It's neither .NET nor Windows specific. I always find when I return to
Eclipse (Windows or Linux) or VS.NET after lunch, they take quite a
while to become fully responsive again.
Maybe some assemblies gets unloaded and then reloaded again.

No, that shouldn't be it.
Are there any situations which may increase this delay?

I don't know exactly how Windows decides when to swap things, but I
suspect that the more applications that are running and the less
physical memory the machine has, the more likely Windows is to swap out
the idle app.
 
J

Jon Skeet [C# MVP]

Also in the case if you have expensive operation on Application load, when
it goes to disk, coming out back will be slow.

No, because the application isn't actually *loading* again - it's just
bringing its virtual memory back from the swap file into physical
memory. The application isn't restarting.
 
J

Jeffrey Tan[MSFT]

Hi Andrea,

Thanks for your feedback.

With the current information available, it is hard to determine if this
delay is caused by the Windows Virtual Memory swap from disk or .Net
FCL/CLR code. I would recommend you to follow the steps in the blog entry
below to obtain a stack trace of the delay(delay troubleshooting steps are
similar to the hang issue), I assume the stack trace may reveal some
internal information(I wrote this blog entry for our team):
"How to debug application crash/hang in production environment?"
http://blogs.msdn.com/msdnts/archive/2006/11/24/how-to-debug-application-cra
sh-hang-in-production-environment.aspx

Note: in this scenario, it may be helpful to use Process Explorer to obtain
the stack trace, because the Process Explorer can provide the kernel-mode
stack trace of certain thread.

I will wait for your further information, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Willy Denoyette [MVP]

I noticed this behavior in a C# application. For its nature the
applications stays mainly minimized to the tray icons
As soon as it's launched the application responds normally. After a
while, when I double click on the tray icon to show the window or I
type a shortcut to open a new dialog (which also contains third-part
controls) it takes much longer to open (even 3-5 seconds).

How is that? Is there a way to avoid this behavior and keep the
application always prompt.

Thanks.
Andrea


Minimized applications and tray Icons, have their "inactive" pages automatically swapped
out to the paging file. In general, it's only a matter of milliseconds to bring these pages
back-in, but if it takes seconds it's an indication that the working set is large and/or
there is a severe lack of physical memory.
This means that other application's pages will have to be swapped-out in order to bring back
your 'tray' application's pages back into the working set.
You can verify this action by watching the memory counters and especially the "working set"
counter of your application using perfmon.exe.

Willy.
 
J

Jeffrey Tan[MSFT]

Hi Andrea,

Have you reviewed my last reply to you? Does it make sense to you? If you
still need any help or have any concern, please feel free to feedback,
thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top