Increasing Heap size on Linux system

This question already has an answer here:

  • Increase heap size in Java 11 answers

  • Java Heap Size Place to store objects created by your Java application, this is where Garbage Collection takes place, the memory used by your Java application. For a heavy Java process, insufficient Heap size will cause the popular java.lang.OutOfMemoryError: Java heap space.

    -Xms<size> - Set initial Java heap size
    -Xmx<size> - Set maximum Java heap size
    
    $ java -Xms512m -Xmx1024m JavaApp
    

    Suggested Java Memory Below is suggested value for a small to medium Java application

    Heap = -Xms512m -Xmx1024m
    

    Source: https://www.mkyong.com/java/find-out-your-java-heap-memory-size/


    这应该有所帮助

    -Xms<size>        set initial Java heap size
    -Xmx<size>        set maximum Java heap size
    -Xss<size>        set java thread stack size
    
    java -Xms4g -Xmx4g ClassName
    
    链接地址: http://www.djcxy.com/p/82790.html

    上一篇: 为什么G1在jmx中的旧gen最大内存等于最大堆大小?

    下一篇: 在Linux系统上增加堆大小