简体   繁体   English

无法使用ANTS内存分析器检测内存泄漏

[英]Cant detect memory leak with ANTS memory profiler

I have a custom application that allows to open some custom models. 我有一个自定义应用程序,可以打开一些自定义模型。 If I open a model in the application, then open another model - memory isn't released from the first model. 如果我在应用程序中打开一个模型,则打开另一个模型-不会从第一个模型释放内存。

When I try to profile memory leak with profiler (ANTS memory profiler), the application releases memory and I'm not able to track the leak. 当我尝试使用事件探查器(ANTS内存事件探查器)探查内存泄漏时,应用程序释放了内存,而我无法跟踪泄漏。 How can I manage this problem? 我该如何解决这个问题? 探查器的内存使用情况图表

When you take a snap shot ANTS memory profiler does a full garbage collection. 当您拍摄快照时,ANTS内存分析器会执行完整的垃圾回收。

When you want to take a snapshot, I normally take 2-3 snapshots until there is not memory differences between two consecutive snapshots. 当您要拍摄快照时,我通常会拍摄2-3个快照,直到两个连续快照之间没有内存差异为止。 Then compare with your base snapshot. 然后与您的基本快照进行比较。

Go to instance list and see if there is any instances are growing. 转到实例列表,查看是否有任何实例在增长。 Select the Objects with Source in order to get rid of heaps of system object. 选择带源的对象,以摆脱系统对象的堆。

If there is any growing instances, pick one and see the objects retention graph which will show you exactly which instance holds the reference. 如果有任何增长的实例,请选择一个实例并查看对象保留图,该图将向您确切显示哪个实例拥有引用。

And also, make sure that you have implemented IDisposable properly and dispose all disposable objects and unsubscribe from all event subscriptions. 另外,请确保已正确实现IDisposable并处置所有一次性对象,并取消所有事件订阅的订阅。

Have a look at below walkthroughs 看看下面的演练

http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/walkthrough http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/ http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/ 演练http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM