title: Spring Boot using dramatically more memory on 64-bit JVM
body: <p>When running the same Spring Boot application on a 64-bit JVM (vs 32-bit), the memory usage is dramatically higher. </p>
  
  <p>For the sample Eureka application below, the 32-bit JVM uses about 100 MB of RAM, whereas the 64-bit JVM uses about 700 MB of RAM. Running multiple microservices on the same computer starts to be a problem.</p>
  
  <p>Does anyone know what is causing this? And most importantly, how can we eliminate the excessive memory use?</p>
  
  <p>The example below is a slimmed-down version of our Eurkea server but it is happening with all of our Spring Boot microservices.</p>
  
  <p>The java source:</p>
  
  <pre><code>@SpringBootApplication
  @EnableEurekaServer
  public class Eureka_SpringMVC {
  
      public static void main(String[] args) {
          ConfigurableApplicationContext context = new SpringApplicationBuilder(Eureka_SpringMVC.class).headless(false).run(args);
    }
  
  }
  </code></pre>
  
  <p>And the Maven pom:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;ca.twosd.tcms&lt;/groupId&gt;
  &lt;artifactId&gt;TCMS_Web_Eureka&lt;/artifactId&gt;
  &lt;version&gt;1.0.0&lt;/version&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
      &lt;artifactId&gt;spring-cloud-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;Camden.SR6&lt;/version&gt;  &lt;!-- Name of release train --&gt;
  &lt;/parent&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;!-- Setup Spring Boot --&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;!-- Setup Spring MVC &amp; REST, use Embedded Tomcat --&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;!-- Spring Cloud starter --&gt;
          &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
          &lt;artifactId&gt;spring-cloud-starter&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;!-- Eureka for service registration --&gt;
          &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
          &lt;artifactId&gt;spring-cloud-starter-eureka-server&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  
  &lt;properties&gt;
      &lt;start-class&gt;ca.eurekatest.Eureka_SpringMVC&lt;/start-class&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;maven.compiler.source&gt;1.7&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;1.7&lt;/maven.compiler.target&gt;
  &lt;/properties&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Thanks!</p>