Windows的working set

Windows的工作集管理是内存管理的重要部分,它涉及到进程在物理内存中的驻留页面。默认情况下,工作集有最小和最大限制,但可以使用SetProcessWorkingSetSize函数调整。在内存充足时,工作集可能会超过最大限制;反之,当内存紧张时,系统会进行工作集修剪。工作集过大可能是内存泄漏的迹象,但最可靠的判断依据是虚拟内存大小的变化。Windows Server 2003引入了硬工作集限制,允许更精细的内存控制。
摘要由CSDN通过智能技术生成

在研究进程performance问题时,碰到process working set的疑惑。结论是process working set是指进程空间中当前存在于物理内存(RAM)中的那部分。当出现page faul,而内存又充足时,会在RAM中分配物理内存页给当前进程。windows的memory mgt负责这块。如果内存充足,process working set不会trim。

但是,如果process working set值不断增大,可能有内存泄露。当然,个人认为,判断memory leak的最可靠标识,还是监控virtual memory size。

《Microsoft Windows Internals》第四版里面的有小节讲的很清楚:

cited from <Microsoft WIndows Internal, Fourth Edition>:

Working Set Management

Every process starts with a default working set minimum of 50 pages and a working set maximum of 345 pages. Although it has little effect, you can change the process working set limits with the Windows SetProcessWorkingSetSize function, though you must have the "increase scheduling priority" user right to do this. However, unless you have configured the process to use hard working set limits (new in Windows Server 2003), these limits are ignored, in that the memory manager will permit a process to grow beyond its maximum if it is paging heavily and there is ample memory (and conversely, the memory manage

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值