通过命令行增加 Java 中的 MaxPermSize 内存

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

to increase MaxPermSize memory in Java by command line

javajdk1.6

提问by user2249205

Could you please explain me how to increase this PermSpace size. I am using Gate application and loading huge amount of data and large number of plugins and unfortunately after every run it gives the error about the out of memory maxPermSpace.

你能解释一下如何增加这个 PermSpace 的大小。我正在使用 Gate 应用程序并加载大量数据和大量插件,不幸的是,每次运行后它都会给出有关内存不足 maxPermSpace 的错误。

I searched everywhere, but I could not find how to increase this size through command line or may be the file where I could update the data?

我到处搜索,但找不到如何通过命令行增加这个大小,或者可能是我可以更新数据的文件?

I really need some help in order to complete my project. Please explain how to do this by command line I am using jdk1.6.0_38 version and win7(64bit).

我真的需要一些帮助才能完成我的项目。请解释如何通过命令行执行此操作我使用的是 jdk1.6.0_38 版本和 win7(64 位)。

回答by Alex

You have to use -XX:MaxPermSize. A sample command could be:

你必须使用-XX:MaxPermSize. 示例命令可以是:

java -Xms128m -Xmx512m -XX:MaxPermSize=512m ...

回答by Joop Eggen

-XX:MaxPermSize=256m

Maybe combined with 32 bit addresses for objects, instead of 64 bits

可能与对象的 32 位地址相结合,而不是 64 位

-XX:+UseCompressedOops

Enables the use of compressed pointers (object references represented as 32 bit offsets instead of 64-bit pointers) for optimized 64-bit performance with Java heap sizes less than 32gb.

允许使用压缩指针(对象引用表示为 32 位偏移而不是 64 位指针)以优化 64 位性能,Java 堆大小小于 32GB。

See VM Options.

请参阅VM 选项

Also check that String internalization does not occur. XML introduced in the past a String.intern()to save space, but then Perm space grows. So maybe check your XML settings.

还要检查 String 内部化没有发生。过去引入 XML 是String.intern()为了节省空间,但后来 Perm 空间增加了。所以也许检查您的 XML 设置。

回答by Lucas Moreira

From Gate's documentation

来自 Gate 的文档

2.7.5 I got the error: Could not reserve enough space for object heap [#]

2.7.5 报错:无法为对象堆保留足够的空间[#]

GATE doesn't use the JAVA_OPTS variable. The default memory allocations are defined in the gate/build.xml file but you can override them by creating a file called build.properties in the same directory containing
runtime.start.memory=256m
runtime.max.memory=1048m

GATE 不使用 JAVA_OPTS 变量。默认内存分配在 gate/build.xml 文件中定义,但您可以通过在包含以下内容的同一目录中创建名为 build.properties 的文件来覆盖它们
runtime.start.memory=256m
runtime.max.memory=1048m

Check your gate/build.xml file and include the options cited in the other answers

检查您的 gate/build.xml 文件并包含其他答案中引用的选项