Solved

Memory Hog - C# -  UI

Posted on 2006-07-06
4
442 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
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Title # Comments Views Activity
Sent email using Shared Mailbox from outlook in C# 5 48
C# Gridview 1 45
C# LINQ ForEach() question 6 48
I need help with Crystal Report's Parameter Prompt Form 2 47
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

792 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