How to increase heap size for jBoss server

前端 未结 9 1174
星月不相逢
星月不相逢 2020-12-31 05:14

I have an upload files scenario in my project. When I\'m trying to upload the large files it\'s giving me an OutOfMemory error. That error is related to Java heap size.

相关标签:
9条回答
  • 2020-12-31 05:33

    I have mentioned the configuration changes needed for the increase of heap size in Windows or Linux environments.

    Linux:

    bin/standalone.conf
    

    Check for the following line,

    JAVA_OPTS
    

    and change it accordingly to suit your heap size needs

    -Xms1303m: initial heap size in megabytes
    -Xmx1303m: maximum heap size in megabytes
    
    JAVA_OPTS="-Xms1024M -Xmx2048M -XX:MaxPermSize=2048M -XX:MaxHeapSize=2048M"
    

    Windows:

    bin/standalone.conf.bat
    
    JAVA_OPTS="-Xms1024M -Xmx2048M -XX:MaxPermSize=2048M -XX:MaxHeapSize=2048M"
    

    Now restart the server and it will work without prompting any heap size errors.

    For more information you can refer this link below.

    https://access.redhat.com/documentation/en-us/jboss_enterprise_application_platform/5/html/getting_started_guide/adjust_memory_settings

    0 讨论(0)
  • 2020-12-31 05:42

    Add following option in jboss in bin/standalone.conf.bat

       set "JAVA_OPTS=-Xms1G -Xmx1G -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=1024m"
    
    0 讨论(0)
  • 2020-12-31 05:44

    Edit the following entry in the run.conf file. But if you have multiple JVMs running on the same JBoss, you might want to run it via command line argument of -Xms2g -Xmx4g (or whatever your preferred start/max memory settings are.

    if [ "x$JAVA_OPTS" = "x" ]; then
        JAVA_OPTS="-Xms2g -Xmx4g -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true
    
    0 讨论(0)
提交回复
热议问题