all groups > dotnet performance > december 2004 >
You're in the

dotnet performance

group:

Huge Memory Use


Huge Memory Use Haim
12/26/2004 6:05:42 AM
dotnet performance: Hello all,
I am writing an application in C#, VB.NET which basicaly
has a form with a few pictureBoxes on it and a TabControl
with 3 tab pages - in each one a treeView and a ListView.
In addition it loads a few other dll's as a reference
which should not be memory consuming since each have a
few simple classes.
The thing is - this application can take up to 40,000KB
of memory!!!
Any idea where to start checking? How can I debug and see
what part of my application is responsible for such
memory usage?

One more thing: I did some tests and noticed that even a
simple form with nothing on it can take up to 15,000KB ,
am I doing something wrong???

Thanks,

Re: Huge Memory Use Bob Grommes
12/26/2004 1:37:40 PM
Haim,

You are doing nothing wrong and there is nothing to be concerned about.

The common language runtime loads for the first executing .NET application,
and takes a certain amount of memory (the same as all other runtimes). In
addition, Windows does not reclaim all released memory until it actually
needs it for something, so memory consumption reported by Task Manager is
not a reliable indication of problems. In fact if you minimize your running
Winforms application you'll usually see memory "usage" drop because that is
one of the times when Windows does its memory housekeeping.

--Bob

[quoted text, click to view]

Re: Huge Memory Use Richard A. Lowe
12/26/2004 2:42:24 PM
This is a common question, you can google many answers to:
http://tech-geeks.org/tiny.php?url=2573

or original URL (watch for wrapping):
http://groups-beta.google.com/groups?hl=en&ie=UTF-8&safe=off&num=10&q=reduce+memory+usage+group%3Amicrosoft.public.dotnet.*&safe=off

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
[quoted text, click to view]

There is a lot to be concerned about... Haim
12/26/2004 11:58:58 PM

This application is tested to run on terminal servers and
as such this memory usage is unacceptable, one of the
main concerns when using a terminal server is how much
memory each application consumes. Imagine 20 users, each
using this application - that would mean almost Giga of
memory usage on the server for this application alone!
40MB of memory is just too much.
I understand that for each dll I'm using in my project
the run time loads the same namespaces
(System.windows.forms for example) again and again. is
there a way to share and load each namespace only once?

Thanks again

Haim.

[quoted text, click to view]
Thanks... Haim
12/27/2004 12:25:38 AM
Just read there something usefull, hope it realy works...


[quoted text, click to view]
8&safe=off&num=10&q=reduce+memory+usage+group%
3Amicrosoft.public.dotnet.*&safe=off
[quoted text, click to view]
Re: There is a lot to be concerned about... Bob Grommes
12/27/2004 9:56:13 AM
You are projecting based on faulty assumptions.

1) If Windows really needs the memory it will grab it.
2) There would only be one instance of the CLR in memory for all users.
3) As I said, Task Manager is not a reliable indicator of the true scope of
the problem, because it does not reflect memory released by applications,
only memory that's both released and reclaimed by Windows memory management.

Put another way, just because in your particular configuration 40MB is in
use, it does not follow that you can multiply that times any number of users
to arrive at the amount of memory that would be used by that many users.
It's not a linear situation. It's much more complicated than that.

The only way to be sure is to run the app under Terminal Services and log on
with 10 users and see what actually happens. My suspicion is that the
actual usage will be something like 25M per user until Windows feels
claustrophobic, at which point it will reclaim the memory that the app has
released, and you'll end up with something more like 15M plus a small amount
per user actually consumed.

--Bob

[quoted text, click to view]

RE: Huge Memory Use Chris
12/29/2004 5:45:03 AM
Are looking you looking at perfomance counters or Task manager ?
In task manager you are seeing the Working Set size, to see what the real
memory use is look at .NET perfomance counters where you will see what the
real memory usage is. It will be much less than what is reported in the task
manager.

Are you experiencing any problems ?
Have you stress tested it to see that it will actually pose a problem ?

The following Google search ' +"working set size" +"net framework" ' will
have more than enough answers to this questions.

One thing : Make sure you are testing on a Release build not a Debug build,
there is a big difference there.

Chris.

[quoted text, click to view]
AddThis Social Bookmark Button