title: How to increase Tomcat Heap memory on windows
body: <p>I read many posts on the internet and here on stackoverflow, but I'm still not able to increase <strong>Tomcat Heap Siz</strong>e.
  Probably I made an error that I can't recognize.</p>
  
  <p>Following this <a href="https://docs.oracle.com/cd/E40518_01/integrator.311/integrator_install/src/cli_ldi_server_config.html" rel="nofollow noreferrer">guide</a>  I did these steps:</p>
  
  <ol>
  <li>I created the file <strong>setenv.bat</strong> inside the folder <strong>{tomcat}\bin</strong></li>
  <li>Inside the file <strong>setenv.bat</strong> I added the string <strong>set "JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx1024m -XX:MaxPermSize=512m -server"</strong></li>
  </ol>
  
  <p>When I run Tomcat and then I launch my app (for instance localhost:8080/appName) and I try to know the heap informations this way:</p>
  
  <pre><code>long maxHeapSize = Runtime.getRuntime().maxMemory();        
  long freeHeapSize = Runtime.getRuntime().freeMemory();  
  long totalHeapSize = Runtime.getRuntime().totalMemory();    
  System.out.println("Max Heap Size = " + (maxHeapSize/1024/1024)+ " MB");    
  System.out.println("Free Heap Size = " + (freeHeapSize/1024/1024)+ " MB");  
  System.out.println("Total Heap Size = " + (totalHeapSize/1024/1024)+ " MB");        
  </code></pre>
  
  <p>I get that the Max Heap Size is always 256 MB.
  Does anybody know what's my error?</p>