Winform application, does the window minimize garbage collection?

Here is the script, winforms application, monitoring through the tab "Task Manager".

At the initial start of the back, up to ~ 61 000K (initial data grid and data loading) If I hide the application without touching or doing nothing, the use of Mem will decrease to 1,380K. When I restore the application, the backs return only up to 5.8K

So my question is, does minimization send some kind of internal message to clear resources, since the application in question is not in focus?

The first application in which I noticed this seems to be VB.NET, but I have observed the same behavior in my main C # winform applications.

+3
source share
1 answer

You are looking at incorrect memory statistics. This "working set" is the amount of virtual memory displayed in physical memory. RAM Windows aggressively trims the working set when it detects minimization of the main window. It is assumed that the user will not use the program for some time, so he throws pages from RAM to free up space for other processes. When you turn the focus back, Windows only displays the pages back to RAM, which are really needed. These are not many of them when the application otherwise fails.

Garbage collection is a virtual memory operation.

+7
source

Source: https://habr.com/ru/post/1790765/


All Articles