tags:

views:

88

answers:

2

Can someone please explain to me why minimizing a windows app massively reduces the memory usage?

For example, I run Visual Studio showing 800MB memory usage in Task Manager then I minimize the Visual Studio app window and the memory usage now only shows 50MB in task manager. This seems to happen in all winforms apps.

+4  A: 

From here:

What Task Manager shows as an application's memory usage is actually its working set. Windows trims the working set of an application when it is minimized, so that's why this figure goes down. The working set is not an accurate representation of how much memory an application is using.

In Windows Vista, Microsoft modified Task Manager to show private bytes instead (which is a much more useful figure), so this phenomenon doesn't occur anymore.

Otávio Décio
You can also use Process Explorer which will show you more detailed information on memory usage than Task Manager (http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx)
0xA3
A: 

It's normal for applications not to be so aggressive about returning memory to the system. A computer doesn't run faster by having a lot of unused memory, so it's better to save the cleanup work until it's really needed.

When you minimise a program, the system sends a signal to it that it's time to return as much memory to the system as possible, so the program does a garbage collection and releases all memory that it can.

Guffa