java “卸载类”消息的含义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2833983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Meaning of the "Unloading class" messages
提问by Eleco
Anyone can explain why the lines below appear in the output console at runtime ?
任何人都可以解释为什么下面的行在运行时出现在输出控制台中?
(one possible answer would be full permGen, but this can be ruled out since the program only uses 24MB out of the max100MB available in PermGen)
(一个可能的答案是 full permGen,但这可以排除,因为该程序只使用了 PermGen 中可用的 max100MB 中的 24MB)
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor28]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor14]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor4]
[Unloading class sun.reflect.GeneratedMethodAccessor5]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor38]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor36]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor22]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor8]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor39]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor16]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor2]
[Unloading class sun.reflect.GeneratedConstructorAccessor1]
[卸载类sun.reflect.GeneratedSerializationConstructorAccessor28]
[卸载类sun.reflect.GeneratedSerializationConstructorAccessor14]
[卸载类sun.reflect.GeneratedSerializationConstructorAccessor4]
[卸载类sun.reflect.GeneratedMethodAccessor5]
[卸载类sun.reflect.GeneratedSerializationConstructorAccessor38]
[卸载类的太阳。 reflect.GeneratedSerializationConstructorAccessor36]
[卸载类sun.reflect.GeneratedSerializationConstructorAccessor22]
[卸载类sun.reflect.GeneratedSerializationConstructorAccessor8]
[卸载类sun.reflect.GeneratedSerializationConstructorAccessor39]
[卸载类 sun.reflect.GeneratedSerializationConstructorAccessor16]
[卸载类 sun.reflect.GeneratedSerializationConstructorAccessor2]
[卸载类 sun.reflect.GeneratedConstructorAccessor1]
The program runs with the following params:
该程序使用以下参数运行:
-Xmx160M
-XX:MaxPermSize=96M
-XX:PermSize=96M
-XX:+UseConcMarkSweepGC
-XX:+UseParNewGC
-XX:+PrintGCTaskTimeStamps
-XX:+PrintHeapAtGC
-XX:+PrintTenuringDistribution
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-verbose:gc
-Xloggc:/logs/gc.log
-Xmx160M
-XX:MaxPermSize参数= 96M
-XX:PermSize = 96M
-XX:+ UseConcMarkSweepGC
-XX:+ UseParNewGC
-XX:+ PrintGCTaskTimeStamps
-XX:+ PrintHeapAtGC
-XX:+ PrintTenuringDistribution
-XX:+ PrintGCDetails
-XX:+ PrintGCDateStamps
- XX:+PrintGCTimeStamps
-verbose:gc
-Xloggc:/logs/gc.log
There's plenty of space in the heap and in permGen.
堆和永久代中有足够的空间。
采纳答案by BalusC
Those classes are hold as softreferenceswhich are always eligible for GC. The GC does not per se onlyrun when the max memory is reached, it will also run when there is room for it, if you understand what I mean.
这些类作为软引用保留,始终有资格进行 GC。GC 本身并不只在达到最大内存时运行,它也会在有空间时运行,如果你理解我的意思的话。
Those classes are by the way used "under the hoods" of the Serialization API which uses reflection to access fields and invoke methods.
顺便说一下,这些类是在序列化 API 的“幕后”中使用的,它使用反射来访问字段和调用方法。
Update: as to logging the class unloading to stdout instead of the path as specified in -Xloggc, there has been a bugreport for exactly this problem: Bug ID 6637203. This was fixed 4 months back. Upgrade your JVM to the latest.
更新:至于将卸载到标准输出的类记录到标准输出而不是 中指定的路径-Xloggc,有一个关于这个问题的错误报告:错误 ID 6637203。这是 4 个月前修复的。将您的 JVM 升级到最新版本。

