Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

increase the java heap size permanently?

People also ask

How increase JVM heap size permanently?

In order to increase that permanently you need to change /etc/profile file. (If you want to increase it to some other value, replace 2048 with the appropriate value in MB). Now log out from your account and log in again. Run the previous command again to check whether it has changed.

Can we increase Java heap size?

To increase the Application Server JVM heap sizeNavigate to the JVM options. Edit the -Xmx256m option. This option sets the JVM heap size. Set the -Xmx256m option to a higher value, such as Xmx1024m.

Is heap permanent?

The permanent generation is the region of the heap where class definitions are stored.


Apparently, _JAVA_OPTIONS works on Linux, too:

$ export _JAVA_OPTIONS="-Xmx1g"
$ java -jar jconsole.jar &
Picked up _JAVA_OPTIONS: -Xmx1g

For Windows users, you can add a system environment variable named _JAVA_OPTIONS, and set the heap size values there. The JVM should be able to grab the virtual machine options from _JAVA_OPTIONS.


This worked for me:

export _JAVA_OPTIONS="-Xmx1g"

It's important that you have no spaces because for me it did not work. I would suggest just copying and pasting. Then I ran:

java -XshowSettings:vm 

and it will tell you:

Picked up _JAVA_OPTIONS: -Xmx1g


what platform are you running?..
if its unix, maybe adding

alias java='java -Xmx1g'  

to .bashrc (or similar) work

edit: Changing XmX to Xmx