Tomcat java.lang.OutOfMemoryError: Java heap space
<p>In my Spring Boot application I want to upload files into a MySql database. When I want to upload large files, I get <code>java.lang.OutOfMemoryError: Java heap space</code> exception. I get it with files about over 60Mb which seems normal because as I know 64Mb is the default heap size. </p>

<p>I've run Tomcat8w.exe and on the Java tab I've added the following lines to the Java Options:</p>

<pre><code>-Xms512m

-Xmx8192m

-XX:PermSize=512m

-XX:MaxPermSize=1024m
</code></pre>

<p>Also, I've created a setenv.bat file into the bin folder with the following content:</p>

<pre><code>JAVA_OPTS="-Xms1024m -Xmx2048m"
</code></pre>

<p>Neither of these worked for me. In catalina-log I see these lines when I start Tomcat:</p>

<pre><code>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
</code></pre>

<p>I have to add that I don't know where the last two lines come from, those are not the values I've specified. </p>

<p>Please, help me, what I do wrong. I need to upload files up to 100Mb.</p>