你在使用。net程序时使用过哪些分析器,你特别推荐哪一个?
当前回答
我们公司为。net选择了YourKit Profiler,因为它是性价比最高的(价格vs功能)。对于一个想要拥有灵活许可(浮动许可)的小公司来说,这是一个完美的选择——当时ANTS是开发人员座位挂坠盒。
此外,它为我们提供了附加到正在运行的进程的能力,这在dotTrace中是不可能实现的。注意,虽然附加不是最好的选择,因为所有的。net程序都会变慢,但这是分析由其他进程启动的。net应用程序的唯一方法。 在功能方面,ANTS和dotTrace更好——但最终YourKit已经足够好了。
其他回答
最新版本的ANTS内存分析器(我认为它是5)简直太棒了!!我使用WinDbg和SOS来解决泄漏,因为它被证明是最好的方法,然后我尝试了ANTS,几分钟就搞定了。真是一个很棒的软件。
不要忘记nProf -一个非常好的免费分析器。
其他人已经介绍了性能分析,但是是关于内存分析 我目前正在评估Scitech . net Memory Profiler 3.1和ANTS Memory Profiler 5.1(2009年9月的当前版本)。一两年前我试过JetBrains,它不如ANTS(内存分析)那么好,所以这次我就不麻烦了。从网站上看,它似乎没有其他两个相同的内存分析功能。
ANTS和Scitech内存分析器都具有其他内存分析器所不具有的特性,因此哪个是最好的取决于您的偏好。一般来说,Scitech提供了更详细的信息,而ANTS在识别泄漏对象方面确实令人难以置信。总的来说,我更喜欢ANTS,因为它在识别可能的泄漏方面非常快。
根据我的经验,以下是每种方法的主要优点和缺点:
ANTS和Scitech .NET内存分析器的共同特征
实时分析功能 他们的网站上有优秀的教学视频 使用方便 合理的性能(明显比没有附加分析器时慢,但不至于让你感到沮丧) 显示泄漏对象的实例 基本上他们都做得很好
ANTS
One-click filters to find common leaks including: objects kept alive only by event handlers, objects that are disposed but still live and objects that are only being kept alive by a reference from a disposed object. This is probably the killer feature of ANTS - finding leaks is incredibly fast because of this. In my experience, the majority of leaks are caused by event handlers not being unhooked and ANTS just takes you straight to these objects. Awesome. Object retention graph. While the same info is available in Scitech, it's much easier to interpret in ANTS. Shows size with children in addition to size of the object itself (but only when an instance is selected unfortunately, not in the overall class list). Better integration to Visual Studio (right-click on graph to jump to file)
Scitech .NET内存分析器
Shows stack trace when object was allocated. This is really useful for objects that are allocated in lots of different places. With ANTS it is difficult to determine exactly where the leaked object was created. Shows count of disposable objects that were not disposed. While not indicative of a leak, it does identify opportunities to fix this problem and improve your application performance as a result of faster garbage collection. More detailed filtering options (several columns can be filtered independently). Presents info on total objects created (including those garbage collected). ANTS only shows 'live' object stats. This makes it easier to analyze and tune overall application performance (eg. identify where lots of objects being created unnecessarily that aren't necessarily leaking).
总的来说,我认为ANTS可以帮助您更快地找到泄漏的内容,而Scitech则提供了关于您的整体应用程序内存性能和单个对象的更多细节,一旦您知道要查看哪些内容(例如。创建时的堆栈跟踪)。如果在ANTS中添加了对未处理的一次性对象的堆栈跟踪和跟踪,我认为没有必要使用其他任何东西。
如果许可是一个问题,您可以尝试WINDBG进行内存分析
如果你是ASP。你可以尝试MVCMiniProfiler (http://benjii.me/2011/07/using-the-mvc-mini-profiler-with-entity-framework/)