在系统本身内存不足之前,我的应用程序的OutOfMemoryException被抛出,如下所述:
MSDN Blogs – Out of memory? Easy ways to increase the memory available to your program.
MSDN Blogs – Out of memory? Easy ways to increase the memory available to your program.
When you run your C# application,you might get an
OutOfMemoryException
thrown,even if your machine has lots of memory. […] That 4 Gigs is divided into half: the user application gets the lower half and the OS gets the upper. (This boundary can be changed: see below).
根据请求,我需要可视化我的应用程序可用的内存量和当前使用情况.可以使用Process.GetCurrentProcess()检索当前用法;和其他人,但如何在运行时确定我的应用程序可用的内存?我只是想不通.
解决方法
您可以在大量分配之前使用
MemoryFailPoint进行检查.这并不是您所要求的,但如果您的故障位于特定的已知大分配点,则至少可以让您在发生分配失败时干净利落地处理分配失败.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。