下载此文档

wpf内存释放.docx


文档分类:IT计算机 | 页数:约8页 举报非法文档有奖
1/8
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/8 下载此文档
文档列表 文档介绍
WPF内存释放
之前写了一遍了,哪知道由于时间太长可能是网站的Session过期了吧,提交之后又让我重新登录,登录之后就哈都没有了,我哭啊。这遍我没有校稿有语句不通顺的地方请大家多多谅解。
   最近一直在做项目忙滴很,所以没时间写博Exit += new ExitEventHandler(App_Exit);
            var timer = new DispatcherTimer{Interval=(20}; 
             += (s, e) => FulshMemor();
            ();
        }
 
在应用程序中,往往为了释放内存等,使用一些函数,其实,对于内存操作函数要谨慎使用,比如大家常常想到的 SetProcessWorkingSetSize,其实对于windows来说,系统会自动在程序闲置时(如程序被最小化)释放内存的,自己用内存释放时,往往会造成一些莫名的内存错误,造成自己的应用程序及系统不稳定。
看看这个API  SetProcessWorkingSetSize
这是从MSDN摘下的原话
Using the SetProcessWorkingSetSize function to set an application's minimum and maximum working set sizes does not guarantee that the requested memory will be reserved, or that it will remain resident at all times. When the application is idle, or a low-memory situation causes a demand for memory, the operating system can reduce the application's working set. An application can use the VirtualLock function to lock ranges of the application's virtual address space in memory; however, that can potentially degrade the performance of the system.
使用这个函数来设置应用程序最小和最大的运行空间,只会保留需要的内存。当应用程序被
闲置或系统内存太低时,操作系统会自动调用这个机制来设置应用程序的内存。应用程序也可以使用   VirtualLock   来锁住一定范围的内存不被系统释放。
When you increase the working set size of an application, you are taking away physical memory from the rest of the system. This can degrade the performance of other applications an

wpf内存释放 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数8
  • 收藏数0 收藏
  • 顶次数0
  • 上传人wxc6688
  • 文件大小512 KB
  • 时间2022-05-10