Memory Query

  • Thread starter Thread starter C# Learner
  • Start date Start date
C

C# Learner

In Windows, when I minimize an app, its memory usage drops
considerably.

Now, I'm making an app that, when the user closes the main form, the
form hides and a notify icon (system tray icon) appears. When the
form hides, this same memory usage drop *doesn't* happen.

Is there a way to manually do this memory usage drop thing? I'd like
to do this when the form is hidden, after the user chooses to close
it, when the notify icon appears.

I remember reading some time ago about a Windows API function call
that could do this, but cannot remember any details.

Thanks in advance.
 
C# Learner said:
In Windows, when I minimize an app, its memory usage drops
considerably.

Now, I'm making an app that, when the user closes the main form, the
form hides and a notify icon (system tray icon) appears. When the
form hides, this same memory usage drop *doesn't* happen.

Is there a way to manually do this memory usage drop thing? I'd like
to do this when the form is hidden, after the user chooses to close
it, when the notify icon appears.

I remember reading some time ago about a Windows API function call
that could do this, but cannot remember any details.

What you're looking at is the working set, which is a very bad measure
of how much memory an app really takes. Minimising an app shrinks the
working set to 0. You could do that yourself via P/Invoke, but it's
more likely to have a negative performance impact than a positive one.
 
Back
Top