In my Spring Boot application I want to upload files into a MySql database. When I want to upload large files, I get java.lang.OutOfMemoryError: Java heap space
exception. I get it with files about over 60Mb which seems normal because as I know 64Mb is the default heap size.
I've run Tomcat8w.exe and on the Java tab I've added the following lines to the Java Options:
-Xms512m
-Xmx8192m
-XX:PermSize=512m
-XX:MaxPermSize=1024m
Also, I've created a setenv.bat file into the bin folder with the following content:
JAVA_OPTS="-Xms1024m -Xmx2048m"
Neither of these worked for me. In catalina-log I see these lines when I start Tomcat:
29-Oct-2016 15:39:42.481 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms512m
29-Oct-2016 15:39:42.481 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx8192m
29-Oct-2016 15:39:42.482 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:PermSize=512m
29-Oct-2016 15:39:42.482 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=1024m
29-Oct-2016 15:39:42.482 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: exit
29-Oct-2016 15:39:42.482 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms256m
29-Oct-2016 15:39:42.483 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx512m
I have to add that I don't know where the last two lines come from, those are not the values I've specified.
Please, help me, what I do wrong. I need to upload files up to 100Mb.