Huge memory usage problem...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,
I have a windows form application which has a simple
buttons toolBar, menuItem and a tab control with 3 tab
pages each holding a treeView and a listView.
When I checked to see how much memory usage my
application demands I was surprised to see that even when
the treeViews and listViews are empty my application
takes about 25,000Kb (25M)!!! of memory usage!
How can this be?
Anyone with any idea as for what can cause such a thing?
Just a simple comparison: Outlook 2003 which I understand
is a .NET application takes up about 15M of memory usage
and its obvious that this is a much bigger application
then mine.
I know its hard to help me without examining my
application but it would help me a lot if someone would
just throw a few ideas...

Thanks,

Haim.
 
1. How do you examine the memory usage of you App? Hint: Taskmanager only
shows the working set, memory usage is something different.
2. The GC only frees memory if memory is needed; This is not neccessarily a
bad thing
3. The .net framework is loaded into your address space; this will take a
lot of space, too.
4. Outlook 2003 is not a .net App.

Niki
 
First of all thanks for your reply.
Second:
1. I examined all aspects of memory usage and no matter
how you look at it - its a lot of memory usage. My main
check is Mem usage & VM usage in the task manager.
My application is supposed to run on a terminal server
for each and every user, and as such this is a main
issue, I can't allow it to consume so much memory.
2. The GC.Collect method in being used at several
locations in my code, this does not help at all...
3. I find it hard to believe that the .NET frameworks
takes that much memory.
4. It helps a bit to know that but still this is too much
memory usage.

Any ideas as for what can I do or check inside my code?

Thanks,

Haim.
 
What does perfmon show you? What are the relative sizes of the gen0, 1 and 2 heaps. If you remove the GC.Collect() calls how often is the GC running in which generation?

Have you tried trimming the working set by P/Invoking SetProcessWorkingSetSize to see what the real memory usage is of your application?

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<[email protected]>

First of all thanks for your reply.
Second:
1. I examined all aspects of memory usage and no matter
how you look at it - its a lot of memory usage. My main
check is Mem usage & VM usage in the task manager.
My application is supposed to run on a terminal server
for each and every user, and as such this is a main
issue, I can't allow it to consume so much memory.
2. The GC.Collect method in being used at several
locations in my code, this does not help at all...
3. I find it hard to believe that the .NET frameworks
takes that much memory.
4. It helps a bit to know that but still this is too much
memory usage.

Any ideas as for what can I do or check inside my code?

Thanks,

Haim.
-----Original Message-----
1. How do you examine the memory usage of you App? Hint: Taskmanager only
shows the working set, memory usage is something different.
2. The GC only frees memory if memory is needed; This is not neccessarily a
bad thing
3. The .net framework is loaded into your address space; this will take a
lot of space, too.
4. Outlook 2003 is not a .net App.

Niki




.

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.769 / Virus Database: 516 - Release Date: 24/09/2004



[microsoft.public.dotnet.framework]
 
Not a very good idea to call GC.Collect( ) all over the place.
http://blogs.msdn.com/ricom/archive/2003/12/02/40780.aspx

You cannot compare .NET apps to say C++ or even VB apps. Since the CLR is
being loaded into memory, your .NET apps are almost always going to have a
larger memory footprint with the CLR being a comparatively larger runtime
compared to the previous runtimes (VB runtimes, etc).

You could run a profiler to check for performance issues.
http://www.gotdotnet.com/team/clr/about_clr_performance.aspx
The link above has a download link for the CLR profiler. There are other
performance related links which maybe of help.

hope that helps..
Imran.
 
Back
Top