Increasing heap size on Linux machines

I am on an Ubuntu desktop machine and I would like to increase the heap size for Java. RAM is 16 GB and the maximum heap size is 3 GB

I checked this post post Increase Tomcat heap size

Not much about Ubuntu, so I tried this command:

java -Xmx10000m -X2000m -XshowSettings:all

      

and the result is:

Min Heap Size: 1.95G
Max Heap Size: 9.77G

      

then sudo gedit /etc/tomcat7/default

and changed this lino to:

JAVA_OPTS="-Djava.awt.headless=true -Xmx10000m -XX:MaxPermSize=2000m" 

      

but then I restarted the machine and checked the max size using:

java -XshowSettings:all

      

and it shows:

Max Heap Size (Estimated): 3.80GB

      

I wanted to take advantage of the high RAM (16GB). Is there anything else I can do?

+3


source to share


2 answers


Have you changed your Tomcat configuration and expect all JVM instances to get these settings somehow? This is not how it works, this parameter will only be used to start the JVMs used by Tomcat, not to run in a shell.



Look here for permanent heap resizing.

+5


source


You can use the following piece of code:

java -XX:+PrintFlagsFinal -Xms512m -Xmx1024m -Xss512k -XX:PermSize=64m -XX:MaxPermSize=128m
    -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'

      



On my computer, I get the following output:

    uintx InitialHeapSize                          := 536870912       {product}
    uintx MaxHeapSize                              := 1073741824      {product}
    uintx PermSize                                 := 67108864        {pd product}
    uintx MaxPermSize                              := 134217728       {pd product}
     intx ThreadStackSize                          := 512             {pd product}

      

+1


source







All Articles