各个世代的垃圾收集和阈值 [英] Garbage Collection and threshold values of various generations

查看:52
本文介绍了各个世代的垃圾收集和阈值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了该书的免费副本"

I downloaded a free copy of the book "Under the hood of .Net Memory Management". In one of the chapter, author mentions the threshold values of various generations which will force the GC to collect that particular generation and all the other child generations. Exact text given below :

GC会在以下情况之一下自动在单独的线程上运行.

任何一代中的对象大小达到特定于一代的阈值时.确切地说,在以下情况下:

  • Gen 0命中〜256 K
  • Gen 1命中〜2 MB(此时GC收集了Gen 1和0)
  • Gen 2命中了〜10 MB(此时GC收集了Gen 2、1和0)
  • Gen 0 hits ~256 K
  • Gen 1 hits ~ 2 MB (at which point the GC collects Gen 1 and 0)
  • Gen 2 hits ~10 MB (at which point the GC collects Gen 2, 1 and 0)

值得牢记的是,上述阈值仅仅是开始水平,因为 .NET会根据应用程序的行为来修改级别.

It's worth bearing in mind that the above thresholds are merely starting levels, because .NET modifies the levels depending on the application's behavior.

我想知道是否有一种方法可以确定给定应用程序在运行时其第二代的当前阈值是多少.

I wanted to know if there is a way to figure out as what is the current threshold value of say Generation-2 for a given application while it is running.

推荐答案

类似的问题另一个,两者都拒绝.在 GC类中,我也看不到任何东西.

Similar question and another and both say no. I don't see anything in the GC class either.

这篇关于各个世代的垃圾收集和阈值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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