如何分析.NET垃圾收集器? [英] how to profile .net garbage collector?

查看:149
本文介绍了如何分析.NET垃圾收集器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何分析垃圾收集器的性能和监控三代。我不知道是否有可能知道在任何时间点有什么生活在 gen0,第一代,第二代。当前对象

I'd like to know how to profile the performance of the garbage collector and monitor the three generations. I wonder if it is possible to know at any point in time what are the current objects living in gen0,gen1,gen2.

推荐答案

您可以得到的有用的GC性能从性能监视器信息 - 不是颗粒状,只要你想,虽然

You can get useful information on GC performance from PerfMon - not as granular as you want though.

有许多.NET内存性能   计数器,这是为了给你   在跨$ P $的一些准则pting的   计数器数据以及如何关联   他们。这里假设你有一个基本的   认识GC的。

There are many .NET Memory Performance Counters and this is meant to give you some guidelines in interpreting the counter data and how to correlate them. This assumes you have a basic understanding of GC.

如果您有Visual Studio的premium版本包括一个性能/分析工具,你可以在单个对象的分配和生命周期的详细信息。具体而言,这可能是你希望的领域:

If you have one of the premium versions of Visual Studio that includes Performance/Profiling Tools, you can get more info on individual object allocations and lifetimes. Specifically, this might be in the area you wished:

垃圾回收器回收内存   通过重新分配了整整一代   对象。对于异形物体   创建的应用程序,对象   终身视图显示的号码,   的对象和产生的尺寸   当他们被回收。

The garbage collector reclaims memory by deallocating a whole generation of objects. For objects that the profiled application created, the Object Lifetime view displays the number and size of the objects and the generation when they are reclaimed.

如果你感觉真的冒险,你可以使用分析工具定制分析API

If you are feeling really adventurous, you can do custom profiling using the Profiling Tools API.

这篇关于如何分析.NET垃圾收集器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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