如何诊断System.OutOfMemoryException? [英] How To Diagnose A System.OutOfMemoryException?

查看:96
本文介绍了如何诊断System.OutOfMemoryException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我上周五在下班前运行了一些代码,而我在周一在这里,但由于OutOfMemoryException而停止了运行.我估计这整个过程需要进行数百亿次的计算,因此这不是一个小任务.

I ran some code last Friday before leaving work, and I'm here on Monday, and it stopped with an OutOfMemoryException. This entire process I estimate required making tens of billions of calculations, so it wasn't some small task.

我什至不知道如何开始解决这个问题.
有指针吗?

I don't even know how to begin fixing this.
Any pointers?

推荐答案

好吧,鉴于您提供的竞争优势,或者缺乏竞争优势,我只能在此处提供一些一般性的想法:首先,显而易见的答案是查看异常本身中包含的信息,这应该使您了解代码分配失败的地方.

Well, given the contet you provided, or the lack thereof, I can only provide some general ideas here: First of all, the obvious answer would be to take a look at the information contained in the exception itself, which should give you an idea of where in your code allocation failed.

第二,您使用内存分析来更好地了解应用程序中发生的事情-我是

Second, you employ memory profiling to get a better idea of what is going on in your application - I'm a user of dotTrace, but there might be free alternatives available.

除了这个一般的地方以外,您可能还想在问题中加入一些其他信息.您要分配什么类型的对象,何时分配,是否正在使用本机资源等.

Apart from this general adivce, you might want to include some more information in your question. What type of objects are you allocating, when are you allocating, are you using native resources etc.

这篇关于如何诊断System.OutOfMemoryException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆