title: Fail to start Glassfish 3.1: java.io.IOException: error=12, Cannot allocate memory
body: <p>I just purchase a ubuntu 9.0.4 VPS (256 MB Dedicated RAM (512 MB Burstable)) from A2Hosting and try to throw a Glassfish server on it. When I try <code>asadmin start-domain</code> I got this error</p>
  
  <pre><code>JVM failed to start: java.io.IOException: Cannot run program "/usr/local/jdk1.6.0_22/bin/java" 
  (in directory "/home/harry/glassfish3/glassfish/domains/domain1/config"):
  java.io.IOException: error=12, Cannot allocate memory
  Command start-domain failed.
  </code></pre>
  
  <p>Here is the result of the <code>free</code> command.  </p>
  
  <pre><code>             total       used       free     shared    buffers     cached  
  Mem:        524288     148552     375736          0          0          0  
  -/+ buffers/cache:     148552     375736  
  Swap:            0          0          0
  </code></pre>
  
  <p><strong>EDIT</strong>
  contain of <code>domain.xml</code></p>
  
  <pre><code>    &lt;java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUGGER_PORT}" system-classpath="" classpath-suffix=""&gt;
           &lt;jvm-options&gt;-XX:MaxPermSize=192m&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-server&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-XX:+UnlockDiagnosticVMOptions&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-DANTLR_USE_DIRECT_CLASS_LOADING=true&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-XX:NewRatio=2&lt;/jvm-options&gt;
           &lt;jvm-options&gt;-Xmx512m&lt;/jvm-options&gt;
           &lt;!-- Port on which remote shell listens for connections.--&gt;
           &lt;jvm-options&gt;-Dosgi.shell.telnet.port=${OSGI_SHELL_TELNET_PORT}&lt;/jvm-options&gt;
           &lt;!-- How many concurrent users can connect to this remote shell --&gt;
           &lt;jvm-options&gt;-Dosgi.shell.telnet.maxconn=1&lt;/jvm-options&gt;
           &lt;!-- From which hosts users can connect --&gt;
           &lt;jvm-options&gt;-Dosgi.shell.telnet.ip=127.0.0.1&lt;/jvm-options&gt;
           &lt;!-- Directory being watched by fileinstall. --&gt;
           &lt;jvm-options&gt;-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/&lt;/jvm-options&gt;
           &lt;!-- Time period fileinstaller thread in ms. --&gt;
           &lt;jvm-options&gt;-Dfelix.fileinstall.poll=5000&lt;/jvm-options&gt;
           &lt;!-- log level: 1 for error, 2 for warning, 3 for info and 4 for debug. --&gt;
           &lt;jvm-options&gt;-Dfelix.fileinstall.log.level=3&lt;/jvm-options&gt;
           &lt;!-- should new bundles be started or installed only?
               true =&gt; start, false =&gt; only install
           --&gt;
           &lt;jvm-options&gt;-Dfelix.fileinstall.bundles.new.start=true&lt;/jvm-options&gt;
           &lt;!-- should watched bundles be started transiently or persistently --&gt;
           &lt;jvm-options&gt;-Dfelix.fileinstall.bundles.startTransient=true&lt;/jvm-options&gt;
           &lt;!-- End of OSGi bundle configurations --&gt;
      &lt;/java-config&gt;
  </code></pre>