A weird memory problem / C# Express BETA

  • Thread starter Thread starter Matthias S.
  • Start date Start date
M

Matthias S.

I'm using C#Express Beta and the framework 2.0.

I recently realized that my application, when starting has a workingset
peak of ~128 MegaB. I startet wondering a bit because the application
didn't yet do anything really usefull.

So I fired up the IDE, created an empty WinForms project and compiled a
release build. Please note that I have not added any extra code! Here is
what I have figured out:

1. On launching the resulting exe, the TaskManager shows a workingset of
~70 MegaB.

2. When I minimize the MainForm window the workingset shrinks to ~400 KiloB.

3. Maximizing the window again results in a workingset of ~1460 KiloB,
which I could live with.

Does anyone have an idea how to go on about this?



BTW.: Is there a way to monitor in detail what and where and how your
application is using up the memory? I have a monitor to get information
as of what modules are loaded, but is ther a way to figure out of what
classes or resources are taking up the space?

Any pointers are highly appreceated.

Thanks in advance,

Matthias
 
I assume you are looking at the memory consumption in task manager. To me this is one of the most useless measures of memory there is as it doesn't actually tell you the amount of memory the application is using it simply tells you the working set. Minimising an application trims the working set (you'll see the same behavior in Word for example) and so when you remaximize you see the actual figures of memory consumption (more or less). You can do the same in your application to make things "look" better by using P/Invoke to

SetProcessWorkingSetSize(hProc, -1, -1); //hproc is the process handle which you can get by P/Invoking to GetCurrentProcess

But you aren't really changing anything (in fact you'll probably slow your application down as it will have to page a bunch of stuff from disk)

Regards

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

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

I'm using C#Express Beta and the framework 2.0.

I recently realized that my application, when starting has a workingset
peak of ~128 MegaB. I startet wondering a bit because the application
didn't yet do anything really usefull.

So I fired up the IDE, created an empty WinForms project and compiled a
release build. Please note that I have not added any extra code! Here is
what I have figured out:

1. On launching the resulting exe, the TaskManager shows a workingset of
~70 MegaB.

2. When I minimize the MainForm window the workingset shrinks to ~400 KiloB.

3. Maximizing the window again results in a workingset of ~1460 KiloB,
which I could live with.

Does anyone have an idea how to go on about this?



BTW.: Is there a way to monitor in detail what and where and how your
application is using up the memory? I have a monitor to get information
as of what modules are loaded, but is ther a way to figure out of what
classes or resources are taking up the space?

Any pointers are highly appreceated.

Thanks in advance,

Matthias

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



[microsoft.public.dotnet.languages.csharp]
 
Back
Top