增加堆大小的JAVA_OPTS。

时间:2021-01-25 17:19:36

I want to increase my Heap size. How can I use JAVA_OPTS for doing so.I am getting the following error may be this is because of low heap size

我想增加堆大小。我如何使用JAVA_OPTS来实现这一点。我得到的错误可能是由于堆大小太低

UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOfRange(Arrays.java:3209)
    at java.lang.String.<init>(String.java:215)
    at java.lang.StringBuilder.toString(StringBuilder.java:430)
    at com.android.dx.rop.type.Prototype.withFirstParameter(Prototype.java:370)
    at com.android.dx.rop.code.Rops.ropFor(Rops.java:1210)
    at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:478)
    at com.android.dx.cf.code.Simulator$SimVisitor.visitConstant(Simulator.java:692)
    at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:763)
    at com.android.dx.cf.code.Simulator.simulate(Simulator.java:95)
    at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:684)
    at com.android.dx.cf.code.Ropper.doit(Ropper.java:639)
    at com.android.dx.cf.code.Ropper.convert(Ropper.java:252)
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:256)

1 个解决方案

#1


34  

You should be able to use the information found in this post.

你应该能够使用在这篇文章中找到的信息。

-Xmszzzm

where zzz is your minimum size.

zz是你的最小尺寸。

-Xmxzzzm

where zzz is your maximum size.

其中zzz是你的最大尺寸。

JAVA_OPTS="-Xms128m -Xmx512m"

You can find more info on VM args here.

你可以在这里找到更多关于VM args的信息。

How to set it globally in your environment depends on your operating system. Which OS are you using?

在您的环境中如何设置它取决于您的操作系统。你在用哪个操作系统?

EDIT: I see the "ubuntu" tag now.

编辑:我现在看到了“ubuntu”标签。

You should just be able to put the JAVA_OPTs line in etc/environment. Once you modify etc/environment, you'll have to log out and back in for the updated environment variables to take effect.

您应该能够在etc/environment中放置JAVA_OPTs行。一旦您修改etc/environment,您将不得不退出并返回更新的环境变量以使其生效。

#1


34  

You should be able to use the information found in this post.

你应该能够使用在这篇文章中找到的信息。

-Xmszzzm

where zzz is your minimum size.

zz是你的最小尺寸。

-Xmxzzzm

where zzz is your maximum size.

其中zzz是你的最大尺寸。

JAVA_OPTS="-Xms128m -Xmx512m"

You can find more info on VM args here.

你可以在这里找到更多关于VM args的信息。

How to set it globally in your environment depends on your operating system. Which OS are you using?

在您的环境中如何设置它取决于您的操作系统。你在用哪个操作系统?

EDIT: I see the "ubuntu" tag now.

编辑:我现在看到了“ubuntu”标签。

You should just be able to put the JAVA_OPTs line in etc/environment. Once you modify etc/environment, you'll have to log out and back in for the updated environment variables to take effect.

您应该能够在etc/environment中放置JAVA_OPTs行。一旦您修改etc/environment,您将不得不退出并返回更新的环境变量以使其生效。