Error: Java Heap Space

  • Last update:July 08, 2022
  • I. Description

    When querying a large amount of data from the database, each template fetches several million pieces of data, or frequently refreshing projects and templates, it will occupy a large amount of memory of the Java Virtual achine JVM. If the memory exceeds the memory, it will be reported to java.lang.OutOfMemoryError: Java heap space memory overflow error, the specific error is as follows:

    II. Reason

    An error is thrown due to insufficient JVM of the server. The JVM will automatically set the value of heap size when it starts. The initial space (-Xms) is 1/64 of the physical memory, and the maximum space (-Xmx) is the physical memory. 1/4. So you can modify the options such as -Xmn -Xms -Xmx of the JVM according to your own situation.

    1. Memory size setting

    When the heap size is set too small, in addition to reporting exception information, you will also find that the execution speed of the report becomes slower.

    Note: The maximum heap size should not exceed 80% of the available physical memory. Generally, the -Xms and -Xmx options should be set to the same, and -Xmn is 1/4 of the -Xmx value. The -Xms -Xmn setting of heap size should not exceed the size of physical memory. Otherwise it will prompt "Error occurred during initialization of VM Could not reserve enough space for object heap"

    III.Solutions

    1. Increase the memory of the server

    For the memory modification of the server, please refer to Modify FineReport configuration parameters.


    2. Enable disk caching

    We use the memory cache by default, that is, all the retrieved data is placed in the server memory. At this time, if the amount of data is large, it is likely to cause insufficient memory. Change to disk cache, which is to put the retrieved data part in Part of the memory is placed on the disk, which can reduce the server memory usage, but reading data from the disk will cause the efficiency of fetching to decrease and increase the time.

    For specific operations, please refer to the section about cache to disk of Data Cache.


    Attachment List


    Theme: Performance Optimization
    • 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