In Java is Permanent Generation space garbage collected?(在 Java 中是否收集了永久代空间垃圾?)
问题描述
我已经读到 Perm gen(或 Permanent Generation)空间不是垃圾收集的.但是,在 CMS 集合中,我可以在 GC 日志中看到一些类正在卸载.那么 perm gen 垃圾是在完全收集还是 CMS 收集期间收集的?
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?
推荐答案
PermGen 像堆的其他部分一样被垃圾收集.
The PermGen is garbage collected like the other parts of the heap.
这里要注意的是,PermGen 包含类和对象的元数据,即指向分配对象的堆的其余部分的指针.PermGen 还包含在使用结束时必须手动销毁的类加载器,否则它们会保留在内存中并保持对堆上对象的引用.Jon Masamitsu 在 Sun/Oracle 博客网站上的 "Presenting the Permanent Generation" 文章可能帮助你.
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 中是否收集了永久代空间垃圾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Java 中是否收集了永久代空间垃圾?


基础教程推荐
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 降序排序:Java Map 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01