Skip to main content
Skip table of contents

java.lang.OutOfMemoryError - Java heap space

Symptoms

Typically, when you encounter this error, there is no direct feedback to the user other than files will not upload or download in Shinydrive and the Tomcat Service may have issues starting or stopping. The way you can tell if this is the issue you are facing is to look at the Tomcat logs. In the "tomcat-stdout.yyyy-mm-dd.log" you will find errors like this:

JAVA
ERROR com.shinydocs.utils.ErrorResponseBuilder - java.lang.OutOfMemoryError: Java heap space
com.shinydocs.commons.exceptions.InvalidDataException: java.lang.OutOfMemoryError: Java heap space

Cause

The heap size for Tomcat was not big enough for the usage.  

Solution

The solution to this one is easy, you will just need to add 2 lines to Tomcat's properties 

  1. Go to the Tomcat properties file Tomcat8w.exe, which will be in your Tomcat install directory (Typically: C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\)

  2. Click on the "Java" tab

  3. In the Java Options field, scroll to the bottom and add the following:
    -Xms1024M
    -Xmx4096M
    (The numeric value in those parameters represent the heap size. The first is its initial size, and the second is the maximum. You can adjust those based on the resources the machine has.)

  4. Change the Maximum memory pool to be the same value as -Xmx

  5. Click OK on the Tomcat Properties Window.

  6. Restart the Tomcat Service

If users will be uploading large files (>500 Mb), you will need to adjust the maximum memory for Tomcat. Since there can be some variance in Tomcat memory to file size relation. We recommend starting at 4096 Mb and increasing by 1024 Mb until your needs are met and the error disappears. 


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.