WorkingSet64没有意义 [英] WorkingSet64 Not Making Sense
问题描述
在我的.Net 3.5SP1应用程序(使用VS 2010构建)中,我遇到了内存不足的错误.理想情况下,我将找出正在使用所有内存的内容,并在可能的情况下进行更正.在短期内,我很乐意监控情况,以便我能在事情发生之前采取行动. 因此,我着手跟踪我的内存使用情况.我经常收集这三个值:
In my .Net 3.5SP1 app (built with VS 2010), I am getting out of memory errors. Ideally I will find out what is using all of the memory and correct if possible. In the short term, I would be happy monitoring the situation so i can take action before it happens. So I set out to track my memory usage. I am frequently collecting these three values:
- WorkingSet64
- PeakWorkingSet64
- MaxWorkingSet64
出现一些问题:
- MaxWorkingSet64似乎以kB报告,而不是以字节为单位报告 是以千字节为单位报告而不是以字节为单位吗?
- 出于调试目的,我每隔几行代码跟踪一次内存.当MaxWorkingSet64/1024 = 1380(我相信是1380 MB)时,内存不足,但是WorkingSet64/1024只有622,268kB,而PeakWorkingSet64/1024是655,476kB.如何 如果我只剩下最大内存的50%,我会用光内存吗?
- 我应该监视一个更合适的属性来发现内存不足的迹象吗?
- MaxWorkingSet64 appears to report in kB, not in bytes as documented. Both of the other properties (WorkingSet64 and PeakWorkingSet64) do appear to report in bytes. Is this true: is it reporting in kB not in bytes?
- For purpose of debugging, I am tracking memory every few lines of code. I am running out of memory when MaxWorkingSet64 / 1024 = 1380 (which I believe is 1380 MB), but WorkingSet64 / 1024 is only 622,268kB and PeakWorkingSet64 / 1024 is 655,476kB . How can I run out of memory if I am only 50% of the way to the maximum memory?
- Is there a more appropriate property I should be monitoring for signs of getting near out of memory?
推荐答案
嗨burkeden ,
Hi burkeden,
欢迎来到MSDN论坛.
Welcome to the MSDN forum.
根据您的描述,似乎您的应用程序中存在内存泄漏.建议您检测导致内存不足错误的原因,而不要监视内存大小.
According to your description, it seems that there is memory leak in your application. I suggest you detect what causes out of memory error instead of monitoring the memory size.
您可以参考:
一旦我们确认存在内存泄漏,就该研究内存泄漏的根本问题了.我们将把旅程分为三个阶段,分别是什么,如何以及在哪里.
Once we have confirmed that there is a memory leak, it's time to investigate the root problem of the memory leak. We will divide our journey to the solution in 3 phases what, how and where.
- 什么:-我们将首先尝试调查什么类型的内存泄漏,它是托管内存泄漏还是不受管理的内存泄漏.
- 方法:-真正引起内存泄漏的原因是什么?是连接对象,处理未关闭的某种文件等吗?
- 其中:-哪个函数/例程或逻辑导致了内存泄漏.
此外,还有一些监视.NET应用程序内存的工具:
Moreover, there are existed tools to monitor memory of a .NET application:
这篇关于WorkingSet64没有意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!