By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,796 Members | 1,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,796 IT Pros & Developers. It's quick & easy.

memory usage of .net application

P: n/a
Hi,

I notice if I run my application, the Windows Task Manager
shows the application using around 20MB of memory.

However, after I minimized the application and
maximize/restore the application again, the memory usage
dropped to around 5MB.

It seems like only after startup, it uses up to 20MB of
memory and after you minimize it, the memory usage drops.

Anybody knows why this happens? and Is there anyway to
have the program start running with memory usage of 5MB?

Thank you in advance.

regards,
Sean
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Well, you could do a trick.

In your form's Load event add these lines

this.WindowState = FormWindowState.Minimized;
this.WindowState = FormWindowState.Normal;

The side effect is that it will give the illusion of starting from the taskbar, but will release unused resources used during form creation, or trigger the garbage collector, not sure which.

--
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2

P: n/a
sean <an*******@discussions.microsoft.com> wrote:
I notice if I run my application, the Windows Task Manager
shows the application using around 20MB of memory.

However, after I minimized the application and
maximize/restore the application again, the memory usage
dropped to around 5MB.

It seems like only after startup, it uses up to 20MB of
memory and after you minimize it, the memory usage drops.

Anybody knows why this happens? and Is there anyway to
have the program start running with memory usage of 5MB?


It sounds like you're just going by what task manager is showing, which
is just the working set. There's been a lot of discussion about this in
the newsgroups - do a groups.google.com search on the .NET newsgroups
for "working set" and you'll get loads of hits.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.