[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 449
  • Last Modified:

Memory Hog - C# - UI

Can someone advise, or post some good links on this topic?

1)  topics that explain why the C# UI, or the UI control toolbox items seem to be horribly memory intensive to most applications..  and how best to separate the UI from the rest of the application in a way where the UI does not effect any memory intensive calculation threads that can be occurring at same time.    I noticed in many of my Apps that run intensive calculations on realtime data ..  that the UI eventually locks-up, or hangs after a few minutes and becomes totally unresponsive in some cases...  even though it does not seem like that heavy a load for the App to handle.    Why does the UI seem "glitchy" to me?   Have had a better experience with Java controls..  it seems    ??
0
lblinc
Asked:
lblinc
  • 2
1 Solution
 
gregoryyoungCommented:
" topics that explain why the C# UI, or the UI control toolbox items seem to be horribly memory intensive to most applications..  "

I assume you mean winforms? I have seen many fairly light weight winforms applications but I guess it really depends what you are doing. Winforms can be a bit heavy memory wise. Alot of this is changing though with 3.0. Winforms is not however your only option, you can also use a more platform independent GTK# which is based off the GTK libraries.


"and how best to separate the UI from the rest of the application in a way where the UI does not effect any memory intensive calculation threads that can be occurring at same time. I noticed in many of my Apps that run intensive calculations on realtime data ..  that the UI eventually locks-up, or hangs after a few minutes and becomes totally unresponsive in some cases...  even though it does not seem like that heavy a load for the App to handle.    Why does the UI seem "glitchy" to me?   Have had a better experience with Java controls..  it seems    ??"

Most likely because they are being used incorrectly. I would take a look at using background threads so as to keep your message pump a pumping which makes your app responsive. Remember when you need to update a control you do it on the main thread (i.e. Control.BeginInvoke()).

I would recommend reading http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms06112002.asp and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms08162002.asp for more basic information in the regard.

Cheers,

Greg

0
 
lblincAuthor Commented:
gregory:    thanks much for info.   if you will, let me browse the links later this afternoon, then get back to you.    in the meantime will keep this post open for a bit.
0
 
gregoryyoungCommented:
Also be careful when measuring memory with .net apps .. alot of it has to do with the way garbage collection works .. if you start putting pressure on the GC it will often times be more aggressive with freeing memory = smaller working set. It works alot better when there is extra memory for it to deal with performance wise .. if the system has loits of free resources it is not afraid to use them to offer bettter runtime performance. If the system runs low it is also quick to back off some of those resources.
0
 
Ready1Commented:
memory is not a problem these days its dirt cheap. its all about knowing how to program well. if you have a memory intensive calculation to perform dont do it on the UI thread so it does not block.

Regards,
Ready1
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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now