What MDAs are useful to track a heap corruption?

故事扮演 提交于 2019-12-11 06:24:45

问题


I have a heap corruption in a .NET/C# program and cannot track it with WinDbg + PageHeap + Application Verifier. In the next step, I plan to use Managed Debugging Assistants (MDAs).

Currently I try using these MDAs:

<gcManagedToUnmanaged />
<gcUnmanagedToManaged />
<invalidVariant />

(Having these MDAs enabled makes the program run very slowly.)

Are there any other I can try in this case?


回答1:


As Hans Passant pointed out, the primary MDA for such cases would be <gcUnmanagedToManaged>. However, this MDA makes the program run very slow. Actually, the program becomes unusable (it takes "forever" to draw the program interface), thus it won't work in production. Visually this MDA is as slow as GCStress.

Other useful MDAs (work must faster):

<callbackOnCollectedDelegate />
<invalidOverlappedToPinvoke />
<overlappedFreeError />

To learn more about available MDAs and their detailed description, refer to the MSDN article Diagnosing Errors with Managed Debugging Assistants.

A good article on how to set MDAs for a program is Managed Debugging Assistants in .NET 2.0.

And finally, how to activate MDAs in the system, see Stack Overflow question .NET/C#: How to set debugging environment variable COMPLUS_HeapVerify?.




回答2:


Try one of the commercial tools such as Red Gate's ANT's Memory Profiler or Jetbrain's DotTrace. I use ANTs Memory Profiler and was able to detect the memory leaks and fix the code that was causing the memory leaks, which may eventually lead to heap corruption. Here is an article on finding memory leaks using ANTs Memory Profiler



来源:https://stackoverflow.com/questions/7559374/what-mdas-are-useful-to-track-a-heap-corruption

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!