netbeans 中的 Java 堆空间……但我已经增加了堆大小!

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

Java heap space in netbeans.. but I've increased the heap size already!

javanetbeansout-of-memory

提问by

I'm having an issue with netbeans and Java. My program needs to be able to cope with large files being uploaded via an arraylist. So I used -Xmx512m to increase the maximum heap size via the netbeans.conf file.

我在使用 netbeans 和 Java 时遇到了问题。我的程序需要能够处理通过数组列表上传的大文件。所以我使用 -Xmx512m 通过 netbeans.conf 文件增加最大堆大小。

I know that netbeans is catching the change, and I've restarted multiple times to make sure it is. Still, my program continues to crash with a Java heap space memory error when the total memory parameter is only 66650112 bytes; that is, 64M-ish.

我知道 netbeans 正在捕捉变化,我已经多次重新启动以确保它是。尽管如此,当总内存参数仅为 66650112 字节时,我的程序继续因 Java 堆空间内存错误而崩溃;也就是说,64M-ish。

How can I force this particular class, procedure, whatever, to allow more memory allocation?

我怎样才能强制这个特定的类、过程等允许更多的内存分配?

采纳答案by bruno conde

I think you just configured the maximum heap size of netbeans IDE itself and not your program.

我认为您只是配置了 netbeans IDE 本身的最大堆大小,而不是您的程序。

Go to your project "properties", select "Run" category. In the "VM Options" text box put your arguments (-Xmx512m).

转到您的项目“属性”,选择“运行”类别。在“ VM 选项”文本框中输入您的参数 ( -Xmx512m)。

回答by CookieOfFortune

I believe editing netbeans.conf only changes the maximum the JVM that runs the IDE can use. You'll need to change the project configuration for your program (Because it probably runs in a different Java VM).

我相信编辑 netbeans.conf 只会更改运行 IDE 的 JVM 可以使用的最大值。您需要更改程序的项目配置(因为它可能在不同的 Java VM 中运行)。

回答by willcodejavaforfood

Check out this link for the NetBeans help on setting project properties and in particular the properties for running a project.

查看此链接以获取有关设置项目属性,特别是运行项目的属性的 NetBeans 帮助。

VM Options is where you need to add the -Xmx512m

VM 选项是您需要添加 -Xmx512m 的地方

回答by bruno conde

try on Tools-> Servers-> on the Platformtab there is a VM option below Java Platform.

尝试工具->服务器-> 在平台选项卡上,Java 平台下方有一个 VM 选项。

回答by bruno conde

VM Options is where you need to add the -Xmx512m.....

VM Options 是您需要添加 -Xmx512m .....

as well as -Xms512m

以及 -Xms512m

since:

自从:

-Xms512m -> initial Java heap size -Xmx512m -> max Java heap size

-Xms512m -> 初始 Java 堆大小 -Xmx512m -> 最大 Java 堆大小

thus you would add, in your case: -Xmx512m -Xms512

因此,在您的情况下,您会添加:-Xmx512m -Xms512

in the VM options textfield....

在 VM 选项文本字段中....

回答by Kuruvi

Goto project Properties window. set addition compiler option in Build>Compiling tab to -Xmx512m

转到项目属性窗口。将 Build>Compiling 选项卡中的附加编译器选项设置为 -Xmx512m