[java] Increasing Heap Size on Linux Machines

I work on Ubuntu desktop machine and I'd like to increase heap size for Java. The RAM is 16GB and the current Max Heap Size is 3GB

I checked this post post Increasing Tomcat Heap Size

Not much found 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 an checked the max size using:

java -XshowSettings:all

and this shows:

Max Heap Size (Estimated): 3.80GB

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

This question is related to java linux performance tomcat ubuntu-12.04

The answer is


You can use the following code snippet :

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

In my pc I am getting 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}

Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to linux

grep's at sign caught as whitespace How to prevent Google Colab from disconnecting? "E: Unable to locate package python-pip" on Ubuntu 18.04 How to upgrade Python version to 3.7? Install Qt on Ubuntu Get first line of a shell command's output Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running? Run bash command on jenkins pipeline How to uninstall an older PHP version from centOS7 How to update-alternatives to Python 3 without breaking apt?

Examples related to performance

Why is 2 * (i * i) faster than 2 * i * i in Java? What is the difference between spark.sql.shuffle.partitions and spark.default.parallelism? How to check if a key exists in Json Object and get its value Why does C++ code for testing the Collatz conjecture run faster than hand-written assembly? Most efficient way to map function over numpy array The most efficient way to remove first N elements in a list? Fastest way to get the first n elements of a List into an Array Why is "1000000000000000 in range(1000000000000001)" so fast in Python 3? pandas loc vs. iloc vs. at vs. iat? Android Recyclerview vs ListView with Viewholder

Examples related to tomcat

Jersey stopped working with InjectionManagerFactory not found The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat Spring boot: Unable to start embedded Tomcat servlet container Tomcat 404 error: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start Kill tomcat service running on any port, Windows Tomcat 8 is not able to handle get request with '|' in query parameters? 8080 port already taken issue when trying to redeploy project from Spring Tool Suite IDE 403 Access Denied on Tomcat 8 Manager App without prompting for user/password Difference between Xms and Xmx and XX:MaxPermSize

Examples related to ubuntu-12.04

Increasing Heap Size on Linux Machines wget: unable to resolve host address `http' How to check which PHP extensions have been enabled/disabled in Ubuntu Linux 12.04 LTS? java.lang.Exception: No runnable methods exception in running JUnits Speed up rsync with Simultaneous/Concurrent File Transfers? MySQL Job failed to start CronJob not running libz.so.1: cannot open shared object file error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied Package doesn't exist error in intelliJ