This question already has an answer here:
这个问题在这里已有答案:
- How to deal with “java.lang.OutOfMemoryError: Java heap space” error? 18 answers
如何处理“java.lang.OutOfMemoryError:Java堆空间”错误? 18个答案
I encountered an error in Netbeans:
我在Netbeans中遇到错误:
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError:Java堆空间
This is the first time I encountered this and I don't know how to deal with it.
这是我第一次遇到这个,我不知道如何处理它。
Can somebody explain this error message to me?
有人可以向我解释这个错误信息吗?
And how can I increase the heap memory? Thank you!
我怎样才能增加堆内存?谢谢!
2 个解决方案
#1
You can set it in NetBeans ide in the project properties -> Run -> VM options
您可以在项目属性 - >运行 - > VM选项中的NetBeans ide中进行设置
Right click on your project "Properties" Select "Run" category. Enter your arguments(-Xmx512m) in the "VM Options" text box. Example: Putting -Xmx512m in the "VM Options" text box gives 512Mb maximum heap size to your Java program.
右键单击您的项目“属性”选择“运行”类别。在“VM选项”文本框中输入参数(-Xmx512m)。示例:将-Xmx512m放在“VM Options”文本框中,为Java程序提供512Mb的最大堆大小。
#2
It could be an error related to Netbeans itself, then consider launching Netbeans with -Xmx
key as it is described here: https://performance.netbeans.org/howto/jvmswitches/
它可能是与Netbeans本身相关的错误,然后考虑使用-Xmx密钥启动Netbeans,如下所述:https://performance.netbeans.org/howto/jvmswitches/
Also it could be related to your particular project, you are trying to launch in Netbeans. In this case open project properties, go to Run
section and extend memory for your project via -Xmx
switch in VM Options
as it is shown below:
此外,它可能与您的特定项目有关,您正尝试在Netbeans中启动。在这种情况下打开项目属性,转到Run部分并通过VM Options中的-Xmx开关为项目扩展内存,如下所示:
#1
You can set it in NetBeans ide in the project properties -> Run -> VM options
您可以在项目属性 - >运行 - > VM选项中的NetBeans ide中进行设置
Right click on your project "Properties" Select "Run" category. Enter your arguments(-Xmx512m) in the "VM Options" text box. Example: Putting -Xmx512m in the "VM Options" text box gives 512Mb maximum heap size to your Java program.
右键单击您的项目“属性”选择“运行”类别。在“VM选项”文本框中输入参数(-Xmx512m)。示例:将-Xmx512m放在“VM Options”文本框中,为Java程序提供512Mb的最大堆大小。
#2
It could be an error related to Netbeans itself, then consider launching Netbeans with -Xmx
key as it is described here: https://performance.netbeans.org/howto/jvmswitches/
它可能是与Netbeans本身相关的错误,然后考虑使用-Xmx密钥启动Netbeans,如下所述:https://performance.netbeans.org/howto/jvmswitches/
Also it could be related to your particular project, you are trying to launch in Netbeans. In this case open project properties, go to Run
section and extend memory for your project via -Xmx
switch in VM Options
as it is shown below:
此外,它可能与您的特定项目有关,您正尝试在Netbeans中启动。在这种情况下打开项目属性,转到Run部分并通过VM Options中的-Xmx开关为项目扩展内存,如下所示: