General Windows Forms and Memory Question

Y

Yosh

I am seeing an interesting memory issue with a winform in my application.
I've noticed everytime I show a form in my application, the memory usage
increases. When I close the form, the memory isn't released. The only time
the memory is released is when I "minimize" the application. Eventually,
overtime, my application consumes a good amount of memory.

Has anyone experienced this?

Thanks,

Yosh
 
H

Herfried K. Wagner [MVP]

Yosh said:
I am seeing an interesting memory issue with a winform in my application.
I've noticed everytime I show a form in my application, the memory usage
increases. When I close the form, the memory isn't released. The only time
the memory is released is when I "minimize" the application. Eventually,
overtime, my application consumes a good amount of memory.

Memory usage shown in Windows' task manager is not accurate for .NET-based
applications.

I suggest to take a look at this article:

The working set of an application is trimmed when its top-level window is
minimized
<URL:http://support.microsoft.com/?scid=kb;EN-US;293215>

In addition consider taking a look at the documentation chapters about
Garbage Collection.
 
Y

Yosh

Thank you for the information and article.

What is interesting is... my user claims the application, overtime, begins
to slow his pc (other applications) down as well. When they minimize the
application, then his pc (other applications) respond normally.

I know about GC but I am wondering if there is an issue or if I need to
manually do some memory cleanup to help solve this?

Thanks,

Yosh
 
T

TP

Task manager is as accurate for .NET applications as it is
for non-.NET applications.

It shows the Working Set of each process, as well as
the Private Bytes for each process. (need to tell it to display
the VM Size column to see Private Bytes)

..NET Winforms apps are great, but the thing MS fails to
mention is that they allocate much more memory for
working set, private bytes, and virtual bytes than
most other (older) technologies.

In environments where there is plenty of excess RAM and
few .NET winforms apps it doesn't matter much. When
..NET winforms apps become more common I think people will
start to notice that they need to install more and more
memory to accomplish the same thing.

I do a lot of work with terminal server, and when running .NET
winforms applications I may need to have *several times* more
RAM to support the same number of concurrent users.

It would not surprise me if in a couple of years we see 1GB of
RAM as the recommended *minimum* for a desktop PC.

-TP
 
H

Herfried K. Wagner [MVP]

TP said:
Task manager is as accurate for .NET applications as it is for non-.NET
applications.

It shows the Working Set of each process, as well as the Private Bytes for
each process. (need to tell it to display the VM Size column to see
Private Bytes)

That's true. What I wanted to say is that the application doesn't
necessarily occupy the whole working set internally and that the GC might
free some of the memory if other applications requre additional memory.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top