ReinstallJava
有一个JVMArguments
选择。您可以使用它来传递堆大小,如下所示:
In[1]:= Needs["JLink`"]
In[2]:= Options[ReinstallJava]
Out[2]= {ClassPath -> Automatic, CommandLine -> Automatic,
JVMArguments -> None, ForceLaunch -> False, Default -> Automatic,
CreateExtraLinks -> Automatic, "Asynchronous" -> Automatic}
In[3]:= ?JVMArguments
JVMArguments is an option to InstallJava that
allows you to specify additional command-line
arguments passed to the Java virtual machine at
startup. The string you specify is added to the
command line used to launch Java. You can use this
option to specify properties with the standard -D
syntax, such as "-Dsome.property=true". This
option is not supported on Mac OSX. >>
In[4]:= LoadJavaClass["java.lang.Runtime"];
In[5]:= java`lang`Runtime`getRuntime[]@maxMemory[]
Out[5]= 238616576
In[6]:= ReinstallJava[JVMArguments -> "-Xmx64g"];
In[7]:= LoadJavaClass["java.lang.Runtime"];
In[8]:= java`lang`Runtime`getRuntime[]@maxMemory[]
Out[8]= 61084008448
(我曾经通过阅读中的代码绝望地C:\Program Files\Wolfram Research\Mathematica\7.0\SystemFiles\Links\JLink\Kernel
发现了这一点。在注意到它被列出后,Options[ReinstallJava]
它似乎有点明显......)