title: JMH: invalid initial heap size
body: <p>I test my program performance with JMH. And fail to configure heap size. I wondering why it doesn't work.</p>
  
  <p><strong>Questions:</strong></p>
  
  <ol>
  <li>Why JMH doesn't accept heap size configs?</li>
  <li>Does JMH absorb idea heap size settings without <code>jvmArgs</code> method?</li>
  </ol>
  
  <p><strong>Error:</strong></p>
  
  <pre><code># Run progress: 0.00% complete, ETA 00:04:30
  # VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
  # VM options: -Xms2048m -Xmx2048m -XX:MaxDirectMemorySize=512M
  # Fork: 1 of 1
  Invalid initial heap size: -Xms2048m -Xmx2048m -XX:MaxDirectMemorySize=512M
  Error: Could not create the Java Virtual Machine.
  Error: A fatal exception has occurred. Program will exit.
  &lt;forked VM failed with exit code 1&gt;
  </code></pre>
  
  <p><strong>Main Method:</strong></p>
  
  <pre><code>public static void main(String... args) throws RunnerException, IOException {
      Options opt = new OptionsBuilder()
              .include(".*" + ArraySummatorBenchmarking.class.getSimpleName() + ".*")
              .warmupIterations(5)
              .measurementIterations(5)
              .forks(1)
              .jvmArgs("-Xms2048m -Xmx2048m -XX:MaxDirectMemorySize=512M")
              .build();
      new Runner(opt).run();
  }
  </code></pre>
  
  <p><strong>idea.vmoptions</strong></p>
  
  <pre><code>-server
  -Xms2056m
  -Xmx2056m
  -XX:MaxPermSize=1024m
  -XX:ReservedCodeCacheSize=256m
  -ea
  -Dsun.io.useCanonCaches=false
  -Djava.net.preferIPv4Stack=true
  -Djsse.enableSNIExtension=false
  -XX:+UseCodeCacheFlushing
  -XX:+UseConcMarkSweepGC
  -XX:SoftRefLRUPolicyMSPerMB=50
  -Dawt.useSystemAAFontSettings=lcd
  </code></pre>
  
  <p><strong>Main method options:</strong> </p>
  
  <pre><code>-Xms2048m -Xmx2048m -XX:MaxDirectMemorySize=512M
  </code></pre>