Change max memory heap for Java on Mac OS X

java, macos, scala

Solution

you can set the memory available to the java VM using this parameters:

-Xms64m -Xmx200m

-Xms specifies the minimum memory; -Xmx the maximum one.

You have to specify them when you run your app. For example, if you a jar named app.jar, you can run it typing

java -Xms64m -Xmx512m -jar app.jar

I think that on a 32 bit machine you can't give the JVM more than 1Gb.

Problem

I am trying to change the max memory size "heap" for Java on Mac OS X. I have read many places to change "-XX:MaxPermSize", but I can't find the file and don't know where to change that setting.

Original source