System.OutOfMemory被抛出。如何找到罪魁祸首? [英] System.OutOfMemory being thrown. How to find the culprit?

查看:122
本文介绍了System.OutOfMemory被抛出。如何找到罪魁祸首?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Visual C#Express 2008的,我有一个表格上启动,但使用一个线程与委派显示功能采取基本上所有的处理照顾的应用程序。这种方式,而任务正在处理我的形式不锁定。

I am using Visual C# Express 2008 and I have an application that starts up on a form, but uses a thread with a delegated display function to take care of essentially all the processing. That way my form doesn't lock up while tasks are being processed.

半最近,通过重复过程会多次(后程序处理输入的数据,所以当数据进来,这个过程重复)我的应用程序将与System.OutOfMemory错误崩溃。

Semi-recently, after going through a repeated process a number of times (the program processes incoming data, so when data comes in, the process repeats) my app will crash with a System.OutOfMemory error.

在错误消息中的堆栈跟踪是无用的,因为它只是指导我到那里我称之为委托形式控制功能就行了。

The stack trace in the error message is useless because it only directs me to the the line where I call the delegated form control function.

我听到人们说,他们使用将procmon从Sysinternals的,看看为什么象这样的错误发生。但我,对我的生活,也无法弄明白。我现在用的程序运行不会改变,如果它上升的内存量,它回来了。另外,即使是往上走,我怎么找出哪我的计划的一部分,是什么问题?

I've heard people say they use ProcMon from SysInternals to see why errors like this happen. But I, for the life of me, can't figure it out. The amount of memory I am using doesn't change as the program runs, if it goes up, it comes back down. Plus, even if it was going up, how do I figure out which part of my program is the problem?

我怎么可以去调查这个问题?

How can I go about investigating this problem?

编辑:

所以,进一步深入研究这个问题后,我经历了什么,我曾经重新申报看去。有,我必须hugematrix =新的uint [巨大]少数情况下,让我摆脱了其中约3。

So, after delving further into this issue, I looked through anything that I was ever re-declaring. There were a few instances where I had hugematrix = new uint[gigantic], so I got rid of about 3 of those.

而不是摆脱错误的,它现在更加模糊和混乱。

Instead of getting rid of the error, it is now far more obscured and confusing.

我的应用程序需要输入数据,并使用OpenGL渲染它。现在,而不是抛出System.OutOfMemory它根本不渲染OpenGL的东西。

My application takes the incoming data, and renders it using OpenGL. Now, instead of throwing "System.OutOfMemory" it simply does not render anything with OpenGL.

在我的代码的唯一区别是,我不举办作出新的矩阵数据I情节。这样的话,我希望,我的数组停留在同一个地方在内存中,并没有做任何自杀我LOH。

The only difference in my code is that I do not make new matrices for holding the data I plot. That way, I hope, my array stays in the same place in memory and doesn't do anything suicidal to my LOH.

不幸的是,这远远绞兽超出了我微薄的手段。随着零失误雨后春笋般冒出来,和我所有的数据结构显然还是正确填写,我怎么能找到我的问题?是否OpenGL的使用内存在一个不起眼的方式,以便为失败时不抛出异常?是内存还是有问题?我怎么知道的? 。世界上所有的内存分析器似乎在告诉我很少

Unfortunately, this twists the beast far beyond my meager means. With zero errors popping up, and all my data structures apparently still properly filled, how can I find my problem? Does OpenGL use memory in an obscure way so as to not throw exceptions when it fails? Is memory still a problem? How do I find out? All the memory profilers in the world seem to tell me very little.

编辑:

使用的容载量从这个社会的支持(额外荣誉,以Amissico)错误终于被铲除。很显然,我将项目添加到一个OpenGL列表,根本不把他们从名单。

With the boatloads of support from this community (with extra kudos to Amissico) the error has finally been rooted out. Apparently I was adding items to an OpenGL list, and never taking them off the list.

这终于避让我的应用程序是净内存分析器。在崩溃时它表现在<数据1.5GB;未知> 类别。通过消除(一切都在被评为列表其他人)的过程中,最后一件事要检查出榜单是OpenGL渲染pipleline。剩下的就是历史。

The app that finally clued me in was .Net Memory Profiler. At the time of crash it showed 1.5GB of data in the <unknown> category. Through process of elimination (everything else in the list that was named), the last thing to be checked off the list was the OpenGL rendering pipleline. The rest is history.

推荐答案

根据您的意见的说明,我会怀疑你可能是没有处理你的图片正确的或者说你有严重的大型对象堆碎片,并试图要分配给新的图像时,没有提供足够的连续空间。详情参见这个问题 - http://stackoverflow.com/questions/686950/large-object-heap -fragmentation

Based on the description in your comments, I would suspect that you are either not disposing of your images correctly or that you have severe Large Object Heap fragmentation and, when trying to allocate for a new image, don't have enough contiguous space available. See this question for more info - http://stackoverflow.com/questions/686950/large-object-heap-fragmentation

这篇关于System.OutOfMemory被抛出。如何找到罪魁祸首?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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