现在写一个使用CHtmlView类显示并捕捉保存到图片的MDI软件,但是发现了一个问题:当同时开启几个VIEW工作时,使用的内存非常大,最高时开启5个页面达到120M,手工关闭ChildFrame之后也不能回收,但是最小化窗口之后再使窗口正常化,使用的内存大概只有8M左右.我使用的CMyHtmlView已经是Fix过的了,new出来也delete了,应该也不是Memory Leak的问题,,按照现象似乎是和界面相关的一些资源没有被释放?在MSDN,CSDN和网上都查了很多资料了,也没有得到明确的答案.但是这里以前有人说也出现了这样的情况,比较腾讯的IE内核浏览器就似乎可以回收这部分资源,但是我没有试验过.请教各位高人,有没有知道怎么处理的啊?

解决方案 »

  1.   

    可能吧,你看maxthon还不是,打开几个页面后,内存占用就很吓人。
      

  2.   

    刚下载了一个maxthon 1.5.6(build42)试了试,打开7个页面,内存使用仅占13M,而且我留意了一下,他的窗口在lost focus的时候内存会回收,和SC_MINIMIZE的效果一样,难道使用了虚拟内存?
      

  3.   

    不是说mathxon的人可以跟IE开发小组直接沟通么。
      

  4.   

    SetProcessWorkingSetSizeEx is being called.
    http://windowssdk.msdn.microsoft.com/en-us/library/ms686237.aspx
    dwMinimumWorkingSetSize
    ......
        If both dwMinimumWorkingSetSize and dwMaximumWorkingSetSize have the value (SIZE_T)-1, the function temporarily trims the working set of the specified process to zero. This essentially swaps the process out of physical RAM memory.The full story is too complicated to go into here, but you can read about it in MSDN online or in any advanced book on Windows internals (memory manager). The memory isn't actually de-allocated, it is just ed as "available for other apps". If there is no memory pressure from other applications, then the pages will stay in physical RAM and they'll be available immediately when you restore the application. If there is a lot of memory pressure, the pages that were freed will be re-used by another application. In that case, restoring your application from its minimized state will be slower because the memory has to be "paged back in" from disk.
      

  5.   

    看来是使用虚拟内存了,多谢Jiangsheng,结贴.
      

  6.   

    一般占用内存多点的程序,在转入后台后,都会释放内存
    这些差不多都用是的page file