title: JNI_CreateJavaVM: "Could not reserve enough space for code cache" on OpenBSD
body: <p>I try to invoke Java code from C using OpenJDK 1.8 on OpenBSD 6.1 virtual machine </p>
  
  <p>There is my test program source code:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;jni.h&gt;
  int main(int argc, char *argv[])
  {
  
      JavaVMInitArgs args;
  
      JavaVM *jvm;
      JNIEnv *env;
      JavaVMOption options[1];
  
      args.version = JNI_VERSION_1_6;
  
      options[0].optionString = "-Djava.class.path=.";
      args.options = options;
      args.nOptions = 1;
  
      if ( JNI_CreateJavaVM(&amp;jvm, (void **) &amp;env, (void *) &amp;args))
      {
          fprintf(stderr, "Failed to create the JVM\n");
          exit(1);
      }
  
      (*jvm)-&gt;DestroyJavaVM(jvm);
      return 0;
  }
  </code></pre>
  
  <p>compilation: </p>
  
  <pre><code>gcc -I/usr/local/jdk-1.8.0/include -I/usr/local/jdk-1.8.0/include/openbsd -L/usr/local/jdk-1.8.0/jre/lib/amd64/server -ljvm main.c
  </code></pre>
  
  <p>run: </p>
  
  <pre><code># LD_LIBRARY_PATH=/usr/local/jdk-1.8.0/jre/lib/amd64/server/ ./a.out
  Error occurred during initialization of VM
  Could not reserve enough space for code cache
  </code></pre>
  
  <p>I tried to add <code>-XX:ReservedCodeCacheSize=200m</code> option, but the result is always the same</p>
  
  <p>When I run the test code on Linux, everything works fine</p>