MetaspaceSize的坑
这几天生产上有台机器的Metaspace一直在告警,Metaspace使用达到了97%。使用-XX:MetaspaceSize=512m,告警也还在在持续,查看MC只有81536.0,显然这个参数没起作用。 也有人遇到类似的问题,并在openjdk上提过类似的bug,其实是一个注释的bug,最终在JDK-8151845中修复了。 Class metadata is deallocated when the corresponding Java class is unloaded. Java classes are unloaded as a result of garbage collection, and garbage collections may be induced in order to unload classes and deallocate class metadata. When the space committed for class metadata reaches a certain level (a high-water mark), a garbage collection is induced.