How do I Increase Java Heap space on Mac?

edited December 2016 in Using Processing

I've tried increasing the heap size in preferences but it does not help.

I am creating very large PGraphics objects - the problem occurs when I use the "save" function.

Oddly, the size that won't work had been working fine with default heap. I've rebooted/restarted each time.

java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space at processing.opengl.PSurfaceJOGL$ at

Java ver 8 u111

Any suggestions are appreciated.


  • You may have to use something other than the Processing IDE. (a.k.a use pure Java).
    In Java -

  • Thanks for the link.

    Editing the info.Plist file (-Xmx) seems to work up to a point. For Mac I don't seem to get much beyond 1g. For PC, I am able to use much more of the available memory. I tried adding JVM memory debug info but processing would not run with it.

  • Exactly how much memory is installed in your system?
    If it is 2GB or less, then that is the problem. If 4GB or more, then I have no idea.

  • 8GB on the Mac and 32GB on the PC. The PGraphics I am instantiating could consume no more than 400mb assuming 32b/pixel.

  • Further ... I get the following error - warning that it's bad to set the max heap to high which warrants explanation.

    Could not run the sketch (Target VM failed to initialize). Make sure that you haven't set the maximum available memory too high

  • What value did you put for allotted memory space in preferences?
    8GB is more than enough.
    Try setting some value like 1024MB/1000MB.

  • I tried many different values. I don't think this setting changes heap size at all.

  • It does on my PC, that's all I can say.
    You say

    I tried adding JVM memory debug info but processing would not run with it.

    Do you have any details on why/how processing won't run with JVM memory debug info?

  • Just that when I add that line to info.plist Processing will not launch. There is no feedback, it just wont start. I didn't spend much time on this so I likely did something wrong.

Sign In or Register to comment.