Minimizing and Memory

E

Evan

I noticed that when I Minimize the Form of a WinForms application that the
memory used drops dramtically.

When the Form is restored, the memory usage increases, but not to where it
was.

I would like to duplicate this memory purging myself. Is there a way? I
don't think it's by using GC.Collect() because when I try that, I do not
get the same result.

What is the answer?

Cheers,
Evan
 
M

Mark Keogh

I got this form somewhere of other.
Private Declare Function SetProcessWorkingSetSize Lib "kernel32.dll" (

ByVal hProcess As IntPtr, _

ByVal dwMinimumWorkingSetSize As Int32, _

ByVal dwMaximumWorkingSetSize As Int32_

) As Int32

Public Function SaveMemory() As Int32

Return _

SetProcessWorkingSetSize( _

Diagnostics.Process.GetCurrentProcess.Handle, _

-1, _

-1 _

)

End Sub
 
H

Herfried K. Wagner

Hello,

Evan said:
I noticed that when I Minimize the Form of a WinForms application that
the memory used drops dramtically.

This is by design (other windows applications show this phenomenon too)

Regards,
Herfried K. Wagner
 

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

Top