Solved

Memory Hog - C# -  UI

Posted on 2006-07-06
4
436 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
  • 2
4 Comments
 
LVL 37

Accepted Solution

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Launch Process with NOT as Administrator 15 65
C# Export DataGridView 4 37
Chat Room 1 25
COnsume rest client 6 8
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

10 Experts available now in Live!

Get 1:1 Help Now