在Java中是永久代空间垃圾收集? [英] In Java is Permanent Generation space garbage collected?

查看:364
本文介绍了在Java中是永久代空间垃圾收集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经读过,彼尔姆(或永久代)空间不是垃圾收集。但是,在CMS集合中,我可以看到一些类在我的GC日志中卸载。那么在完整收集或CMS收集过程中收集的perm gen垃圾?

解决方案

PermGen是垃圾收集的,像堆的其他部分。

这里要注意的是,PermGen包含类和对象的元数据,即指向分配对象的堆的其余部分的指针。 PermGen还包含类加载器,它们在使用结束时必须手动销毁,否则它们将停留在内存中,并且还保留对堆中对象的引用。 Sun / Oracle博客网站上的Jon Masamitsu撰写的呈现永久世代文章可能会帮助你。


I have read that Perm gen (or Permanent Generation) space is not garbage collected. However, in CMS collection I can see some classes unloading in my GC log. So is perm gen garbage collected during full collection or CMS collection?

解决方案

The PermGen is garbage collected like the other parts of the heap.

The thing to note here is that the PermGen contains meta-data of the classes and the objects i.e. pointers into the rest of the heap where the objects are allocated. The PermGen also contains Class-loaders which have to be manually destroyed at the end of their use else they stay in memory and also keep holding references to their objects on the heap. The "Presenting the Permanent Generation" article by Jon Masamitsu on the Sun / Oracle blog site might help you.

这篇关于在Java中是永久代空间垃圾收集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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