如何研究.NET中的非托管内存泄漏? [英] How to research unmanaged memory leaks in .NET?

查看:302
本文介绍了如何研究.NET中的非托管内存泄漏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通过MSMQ运行的WCF服务.内存随时间逐渐增加,表明存在某种内存泄漏.我在本地运行该服务,并使用PerfMon监视了一些计数器. CLR内存管理的堆字节总数保持相对恒定,而进程的专用字节随时间增加.这使我相信存在某种不受管理的内存泄漏.假设问题是非托管内存泄漏,我该如何解决该问题?有什么工具可以用来提示导致非托管内存泄漏的原因吗?另外,我所做的所有工作都是从事务队列中读取数据并写入数据库,这都是DTC事务的一部分(通过在服务合同上进行事务处理在幕后进行).我没有对COM或DllImports进行任何明确的操作.

I have a WCF service running over MSMQ. Memory gradually increases over time, indicating that there is some sort of memory leak. I ran the service locally and monitored some counters using PerfMon. Total CLR memory managed heap bytes remains relatively constant, while the process' private bytes increases over time. This leads me to believe that there is some sort of unmanaged memory leak. Assuming that unmanaged memory leak is the issue, how do I address the issue? Are there any tools I could use to give me hints as to what is causing the unmanaged memory leak? Also, all my service is doing is reading from the transactional queue and writing to a database, all as part of a DTC transaction (handled under the hood by requiring a transaction on the service contract). I am not doing anything explicitly with COM or DllImports.

提前谢谢!

推荐答案

如果您愿意学习windbg(

This blog will help you if you are willing to learn about windbg (http://www.microsoft.com/whdc/devtools/debugging/default.mspx).

http://blogs.msdn.com/tess/default.aspx

这篇关于如何研究.NET中的非托管内存泄漏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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