在Java 8中触发元数据空间内存上的gc [英] Triggering of gc on Metaspace memory in java 8

查看:1549
本文介绍了在Java 8中触发元数据空间内存上的gc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当jvm上没有设置MaxMetaspaceSize属性时,什么条件触发Metaspace的垃圾收集。

What condition triggers the garbage collection of Metaspace when MaxMetaspaceSize property is not set on the jvm.

假设我关闭了几个未使用的类加载器,那么有一个可以释放的空间元空间内存中的内存。我的问题是完整的gc触发了元空间内存的清理,还是以其他方式触发。

Say if i close few unused classloaders there is a scope to free up the memory in the metaspace memory. My questions is does the full gc trigger the cleanup of metaspace memory or is it triggered in some other way.

推荐答案


因为默认情况下Java 8中的Metaspace不受限制,jvm何时理解它需要从其元空间中清除未引用的类。

since by default Metaspace in Java 8 is not limited, when does jvm understands that it need to clean up the unreferenced classes from its metaspace.

Metaspace本身不是垃圾收集的。但是java堆是。当收集 java.lang.Class 对象时,底层元数据也会被释放。因此,在大多数情况下,如果有任何类符合卸载条件,常规GC周期也将释放元空间。

Metaspace itself is not garbage-collected. But the java heap is. When java.lang.Class objects get collected the underlying metadata gets freed too. So in most circumstances regular GC cycles will also free up metaspace if there are any classes that are eligible for unloading.


但是想要了解何时是否触发了gc以清除取消部署的应用程序的元空间内存。

but want to understand when does the gc get triggered to cleanup the metaspace memory of the undeployed apps.

最迟当元空间的当前容量已满,可能在常规垃圾收集卸载类时更早。

At the latest when the current capacity of the metaspace is full, possibly earlier when regular garbage collections unload classes.

这篇关于在Java 8中触发元数据空间内存上的gc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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