views:

2129

answers:

6

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.

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.

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

+1  A: 

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).

CookieOfFortune
This is great, thanks!
+1  A: 

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

VM Options is where you need to add the -Xmx512m

willcodejavaforfood
+6  A: 

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

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

bruno conde
A: 
A: 

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

A: 

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

as well as -Xms512m

since:

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

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

in the VM options textfield....