开发者

Winform application, does window minimize force garbage collection?

Here's the scenario, winforms application, monitoring via Task Manager Processes Tab.

On initial launch spins up to ~61,000K (initial data grid and data loads) If I minimize the application, not touching or doing anything the Mem usage drops to 1,380K. When I restore the application is spins back up to only 5.8K

So my question is, does the minimize send some internal message to 开发者_如何学运维clean up resources since the application in question is not in focus?

The first app I noticed this in happens to be VB.NET, but I've observed the same behavior in my main C# winform applications.


You are looking at the wrong memory statistic. That's "working set", the amount of virtual memory that's mapped to physical memory. RAM. Windows aggressively trims the working set when it detects the main window getting minimized. It assumes the user won't be using the program for a while so it unmaps pages from RAM to make room for other processes. When you give it the focus back, Windows only maps pages back to RAM that are actually needed. Which isn't many of them when the app is otherwise idle.

Garbage collection is a virtual memory operation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜