0

I'm on a 64 bit OS on a Mac with 8GB of RAM. I need to allocate 2.9GB to some arrays of bytes in a program written in Java (I simply declare them). Since by default you can't use more than 1GB of heap space for running a java project, you need to specify in the VM options if your program needs more. I am on IntelliJ Idea, so I do this by going on Help -> Edit Custom VM Options and then changing the -xmx field. But no matter how many MBs I allocate, the program can't run due to this exception: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space, as if I didn't change anything in the VM options. The PC has enough free RAM to contain arrays of 2.9GB when running the program.

Mark Smith
  • 103
  • 3

1 Answers1

1

Help -> Edit Custom VM Options is set for IDEA itself but not your program. Set -Xmx in Run -> Edit Configurations.. -> your application -> VM options instead.

djzhu
  • 787
  • 8
  • 11