Solved

Memory Hog - C# -  UI

Posted on 2006-07-06
4
443 Views
Last Modified: 2008-02-01
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
Comment
Question by:lblinc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 250 total points
ID: 17058042
" 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
 

Author Comment

by:lblinc
ID: 17058144
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
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 17058190
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
 
LVL 10

Expert Comment

by:Ready1
ID: 17276310
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…

749 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