垃圾收集中的生成
有人可以解释一下垃圾收集中的代数是什么吗? 我正在互联网上阅读它,但感觉很难理解......
Could somebody please explain me what is generations in garbage collection?
i am reading it on internet but feeling difficult to understand it...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一代是一组对象。分代垃圾收集器根据对象在收集器运行中幸存的次数对对象进行分组。
最初,所有对象都将处于第一代(一组对象)。然后,在垃圾收集器运行之后,一些对象将被收集,因为没有人再引用它们,但其余的将被放置在第二代组中。
这些对象被分为几代,以利用最近创建的对象最常被使用的想法。分代垃圾收集器将比第二代更频繁地收集第一代,并且比第三代更频繁地收集第二代......
A generation is a group of objects. A generational garbage collector groups objects based upon how many runs of the collector they have survived.
Initially, all object will be in the first generation (a group of objects). Then after the garbage collector runs some of the objects will be collected since no one is referencing them anymore but the rest will be placed is the second generation group.
The objects are grouped into generations to exploit the idea that more recently created objects become unused most often. A generational garbage collector will collect the first generation more often than the second generation, and second more than the third...