如何在 Java 8 中设置最小元空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24841616/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 15:08:05  来源:igfitidea点击:

How to set the minimum Metaspace in Java 8

javamemory-managementgarbage-collectionjava-8

提问by Felix

I have the problem, that the default Metaspace size is too small.

我有问题,默认元空间大小太小。

Right after the startup of my (Tomcat and Spring based) web application, there is a major collection, because the Metaspace is exhausted. Before Java 8, I could set the initial PermGen size with -XX:PermSize. Now, I'm searching for a Java 8 equivalent for that, but I had no luck so far. I'm using the G1 garbage collector.

在我的(基于 Tomcat 和 Spring 的)web 应用程序启动后,有一个主要的集合,因为 Metaspace 已经用完了。在 Java 8 之前,我可以使用-XX:PermSize. 现在,我正在为此寻找 Java 8 等价物,但到目前为止我没有运气。我正在使用 G1 垃圾收集器。

采纳答案by Felix

To set the meta space to 100M, use -XX:MetaspaceSize=100M. https://blogs.oracle.com/poonam/entry/about_g1_garbage_collector_permanent

要将元空间设置为 100M,请使用-XX:MetaspaceSize=100M. https://blogs.oracle.com/poonam/entry/about_g1_garbage_collector_permanent