.net - 如何分析 .net 垃圾收集器?

标签 .net garbage-collection

我想知道如何分析垃圾收集器的性能并监控三代。我想知道是否可以在任何时间点知道 gen0,gen1,gen2 中当前存在的对象是什么。

最佳答案

您可以获得useful information on GC performance from PerfMon - 但没有你想要的那么精细。

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.

如果您拥有包含 Performance/Profiling Tools 的 Visual Studio 高级版本之一,您可以获得有关单个对象分配和生命周期的更多信息。具体来说,这可能位于您想要的区域:

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.

如果您真的喜欢冒险,您可以使用 Profiling Tools API 进行自定义分析。 .

关于.net - 如何分析 .net 垃圾收集器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4288898/

相关文章:

c# - 带有集合的 Razor 表单助手,如何正确命名表单元素?

c++ - 启动 C++ 项目。我应该担心释放动态分配的内存吗?

memory-leaks - MonoTouch 对象引用防止垃圾回收

Java "dead"对象未被垃圾收集

java - 异常 java.lang.OutOfMemoryError : GC overhead limit exceeded with tree map

c# - 将 MFC COM 服务器移植到托管代码的最佳方式

c# - 声明泛型类时 new() 的目的是什么?

c# - 如何在分布式系统中生成重复概率低的标识符?

.net - 乘以逆是好是坏?

c# - c#中的垃圾收集误解