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

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?

6 thoughts on “Java heap space in netbeans.. but I’ve increased the heap size already!

  1. user

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

    Reply
  2. user

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

    Reply
  3. user

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

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *