Re: JLink OutOfMemoryError
- To: mathgroup at smc.vnet.net
- Subject: [mg70209] Re: JLink OutOfMemoryError
- From: Peter Pein <petsie at dordos.net>
- Date: Sat, 7 Oct 2006 07:08:09 -0400 (EDT)
- References: <eg4ria$f8s$1@smc.vnet.net>
Allen, Matthew schrieb:
> Hello,
>
> I'm trying to do large array crunching in Mathematica/Jlink. The code
> works fine for small 2D arrays, but when I try to use large arrays (i.e.
> 400000x64) I get a
>
> java.lang.OutOfMemoryError
>
> I've tried to increase the memeory supply by using:
>
> InstallJava[CommandLine->"C:\Program Files\Wolfram
> Research\Mathematica\5.2\SystemFiles\Java\Windows\bin\java.exe -Xms32m
> -Xmx128m"]
>
> but it crashes or asks me to "Select the MathLink file to run." Does
> anybody have any advice. I really need to crunch big arrays and I don't
> want to use another system. Thanks for any advice.
>
> matthew allen
>
> ************************************************
> Matthew Allen
> Senior Member of Technical Staff
> Rad/Nuc Detection Systems
> Sandia National Laboratories/California
> mallen at sandia.gov
> (925)294-6662
> ************************************************
Hi Allen,
either java.exe is on your path:
In[1]:=
Needs["JLink`"];
InstallJava[CommandLine -> "java.exe -Xms32m -Xmx128m"]
Out[2]=
LinkObject["java.exe -Xms32m -Xmx128m -classpath D:\\Programme\\Wolfram
Research\\Mathematica\\5.1\\AddOns\\JLink\\JLink.jar
com.wolfram.jlink.Install", 2, 2]
UninstallJava[];
or you give the path-string in the usual Mathematica for Windoze - way:
In[5]:=
InstallJava[CommandLine -> "C:\\Programme\\Java\\jdk1.6.0\\bin\\java.exe
-Xms32m -Xmx128m"]
Out[5]=
LinkObject["C:\\Programme\\Java\\jdk1.6.0\\bin\\java.exe", 4, 2]
UninstallJava[];
Or you can use ToFileName as you do in other file-related commands:
In[10]:=
InstallJava[CommandLine -> StringJoin[ToFileName[{"C:", "Programme",
"Java", "jre1.6.0", "bin"},
"java.exe"], " -Xms32m -Xmx128m"]]
Out[10]=
LinkObject["C:\\Programme\\Java\\jre1.6.0\\bin\\java.exe", 9, 2]
HTH,
Peter