title: Mathematica & J/Link: Memory Constraints?
body: <p>I am doing a computing-intensive benchmark using Mathematica and its J/Link Java interface.</p>
  
  <p>The benchmark grinds to a halt if a memory footprint of about 320 MB is reached, since this seems to be the limit and the garbage collector needs more and more time and will eventually fail.</p>
  
  <p>The Mathematica function <a href="http://reference.wolfram.com/mathematica/JLink/ref/ReinstallJava.html" rel="noreferrer">ReinstallJava</a> takes the argument command line. I tried to do</p>
  
  <pre><code>ReinstallJava[CommandLine -&gt; "java -Xmx2000m ..."]
  </code></pre>
  
  <p>but Mathematica seems to ignore the -Xmx option completely.</p>
  
  <p>How can I set the -Xmx memory option for my java program? Where does the limit of 320 MB come from? Any help would be greatly appreciated.</p>