Modifying Memory Settings

  • Last update:September 23, 2025
  • Overview

    Scenario

    • When you preview a template, the system throws an Out of Memory (OOM) error: "java.lang.OutOfMemoryError:Java heap space."

    • Tomcat logs a background message: "Memory is over threshold."

    • The system throws the error: "gc overhead."

    • The system throws an OOM error.

    • FineReport consumes excessive JVM memory.

    • You want to adjust the default memory settings of the designer.

    • You want to adjust the default memory settings of Tomcat.

    • The designer slows down and freezes unexpectedly after prolonged use.

    • You are often prompted to wait in the queue when previewing templates.

    • The server is under heavy load.

    Cause

    These errors and scenarios often occur when JVM memory on the server is insufficient. The JVM automatically sets the heap size when it starts.

    If the heap size is too small, the system not only throws errors but also executes reports slowly.

    Solution

    To prevent the OOM issues, you need to adjust the memory size of the server or the designer and enable the disk cache function as needed.

    The document details how to adjust the memory size for the designer and the server, and to enable the disk cache function.

    Modifying Memory Settings of the Tomcat Server

    This document introduces how to modify memory settings specifically for Tomcat servers, not for other servers.

    You are advised to modify the setting items in the following table.

    Memory Configuration Parameter
    DescriptionRecommended Value

    -Xmx

    The -Xmx option defines the maximum memory size of the Java heap.

    It sets an upper limit for the Java heap. When the heap reaches the defined size, the JVM stops allocating new memory, and garbage collection is triggered.

    Recommended value:

    8 GB <= -Xmx < 32 GB or  40 GB <= -Xmx <= 64 GB

     

    iconNote: 
    Heap size below 8 GB poses a risk of system crashes; heap size between 32 GB and 40 GB may cause performance issues; heap size above 64 GB can result in poor performance.

    You can view the recommended on-heap memory size (the -Xmx value) in an inspection report in Health Inspection.

    -Xms

    The -Xms option defines the initial memory size of the Java heap.

    The JVM allocates memory of the defined size as soon as it starts.

    Recommended value: -Xms = -Xmx

    -Xss

    In the JVM, each thread has its own stack. The -Xss option defines the thread stack size.

    Recommended value: below 1024 KB

    In most cases, you do not need to configure -Xss, as the default value is suitable for a wide range of applications. However, you can check and reduce the default value as needed.

    -XX:MaxDirectMemorySize

    The -XX:MaxDirectMemorySize option sets an upper limit for the direct memory allocated by Java NIO, which is a common form of off-heap memory.

    Since the direct memory is allocated from the native memory outside the Java heap, the direct memory size is not limited by the heap size.

    Recommended value: 2 GB; reference range: 2 GB to 4 GB

    The minimum value is 2 GB, with no maximum limit. However, you need to consider the physical memory of the server. The memory used by FineReport is less than or equal to 7/8 of the server memory.

    Dfineio.read_mem_limit

    fineIO read memory

    Recommended value: 2 GB

    Dfineio.write_mem_limit

    fineIO write memory

    Recommended value: 1 GB

    Tomcat Started via startup.bat or startup.sh

    If you start Tomcat via startup.bat or startup.sh, refer to this section to modify the server memory settings.

    Linux

    1. Enter Tomcat installation directory\bin.Find the setenv.sh file.If the file does not exist, you can create one.

    iconNote:

    Ensure that you have the execution permission on the setenv.sh file. If not, you can run the command chmod +x setenv.sh to configure the permission.

     2. Open the setenv.sh file with a text editor. Enter the following lines at the end of the file to modify the JVM memory settings.

    JAVA_OPTS="$JAVA_OPTS -Xms8192M -Xmx8192M -Xss1024k"

    JAVA_OPTS="$JAVA_OPTS -XX:MaxDirectMemorySize=2g"

    JAVA_OPTS="$JAVA_OPTS -Dfineio.read_mem_limit=2"

    JAVA_OPTS="$JAVA_OPTS -Dfineio.write_mem_limit=1"

    3. Save and close the setenv.sh file.

    4. Restart the Tomcat server for the modifications to take effect.

    Windows

    1. Enter Tomcat installation directory\bin. Find the setenv.bat file. If the file does not exist, you can create one.

    iconNote: 
    Ensure that file extensions are displayed for you to locate the right setenv.bat file.

    2. Open the setenv.bat file with a text editor. Enter the following lines at the end of the file to modify the JVM memory settings.

    set JAVA_OPTS=%JAVA_OPTS% -Xms8192M -Xmx8192M -Xss1024k

    set JAVA_OPTS=%JAVA_OPTS% -XX:MaxDirectMemorySize=2g

    set JAVA_OPTS=%JAVA_OPTS% -Dfineio.read_mem_limit=2

    set JAVA_OPTS=%JAVA_OPTS% -Dfineio.write_mem_limit=1

    3. Save and close the setenv.bat file.

    4. Restart the Tomcat server for the modifications to take effect.

    Installed Tomcat

    If Tomcat is started as a service, rather than via startup.bat or startup.sh, you can refer to this section to modify the server memory settings.

    This section takes the combination of Windows 11, Tomcat 9, and JDK 1.8 as an example. (As the steps may vary slightly depending on system and application versions, you need to make adjustments accordingly.)

    Method One

    1. Double-click the Tomcat icon in the system tray at the bottom-right corner of the screen to open the configuration window, select the Java tab, and modify Initial memory pool and Maximum memory pool.

    The maximum memory pool configured should not exceed 80% of the physical memory of the host machine.

    2. Click OK to save the settings, and restart Tomcat for the settings to take effect.

    2.2.1.jpg

    Method Two

    1. Open Registry Editor, and go to the Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\Tomcat9\Parameters\Java directory. (The path may vary slightly depending on your application version.)

    Modify JvmMs (the initial memory pool) and JvmMx( the maximum memory pool).

    2. Restart Tomcat for the modifications to take effect.

    2.2.2..jpg

    Verifying if the Modification is Successful

    Log in to the decision-making platform as the admin, and choose System Management > Intelligent O&M > Load Management > Load Surveillance. You can view the modified total memory, as shown in the following figure.

    3.3.jpg

    Modifying Memory Settings of the Designer

    Windows

    1. Close the designer.

    2. Go to the FineReport installation directory\bin directory and find the designer.vmoptions file.

    3. Open the designer.vmoptions file with a text editor and modify the value of -Xmx. Save the change, and close the file.

    4. Restart the designer for the modification to take effect.

    3.1.jpg

    Mac

    1. Close the designer.

    2. Go to the FineReport installation directory/bin directory, right-click designer, and select Show Package Contents.

    3. Open vmoptions.txt in the Content folder, and modify the value of -Xmx. Save the change, and close the file.

    4. Restart the designer for the modification to take effect.

    3.2.jpg

    Verifying if the Modification is Successful

    Log in to the decision-making platform as the admin, and choose System Management > Intelligent O&M > Load Management > Load Surveillance. You can view the modified total memory, as shown in the following figure.

    3.3.jpg

    Modifying the Cache Path

    The hidden .FineReportXXX folder exists in the system root directory, in which all files are generated by the server.

    The ./ehcache_disk_store file in the folder often occupies a large amount of space, which can easily lead to insufficient disk space in the root directory.

    For details about modifying the path of ./ehcache_disk_store, see Specifying the Ehcache Cache Path. 

    Attachment List


    Theme: Deployment and Integration
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy