WinForm应用程序,并最小化窗口力垃圾收集?最小化、应用程序、垃圾、窗口

由网友(伸手摘星星つ)分享简介:下面的情景,WinForms应用程序,监视通过任务管理器进程选项卡。Here's the scenario, winforms application, monitoring via Task Manager Processes Tab.在首次推出旋转可达〜61,000K(初始数据网格和数据负载)如果我最小化应用...

下面的情景,WinForms应用程序,监视通过任务管理器进程选项卡。

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

在首次推出旋转可达〜61,000K(初始数据网格和数据负载) 如果我最小化应用程序,不接触或做任何事情的内存使用下降到1,380K。 当我恢复应用程序是旋转回最多只有5.8K

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?

第一个应用程序,我注意到这恰好是VB.NET,但我发现在我的主C#的WinForm应用程序相同的行为。

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.

推荐答案

您正在寻找错误的内存统计。这就是工作集,虚拟内存的被映射到物理内存量。随机存取存储器。视窗积极修剪工作集检测到主窗口得到最小化时。它假定用户将不被使用的程序的一个,而因此它取消映射从RAM页面以腾出空间给其他处理。当你给它焦点回来,只适用于Windows的页面映射回真正需要的RAM。这是不是很多人,当应用程序处于空闲状态。

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.

阅读全文

相关推荐

最新文章