Tuesday, October 24, 2006

Matlab: java.lang.OutOfMemoryError

Matlab, as I wrote earlier, can use so called interfaces to work with other programming languages. One of them is Java SDK 1.4.2. Because of that, some time ago I was writing one Java application to work within Matlab. It was image processing application (java class) calculating fractal signatures. The problem with that application was that it used a lot of memory. And this was my problem. By defalut, Matlab, allows to use only 32MB of memory by java programs. When I exited that threshold I get error:

Java exception occurred:
java.lang.OutOfMemoryError: PermGen space

So I did a little of the Internet browsing and I found out that the solution to that problem was to create file java.opts in my working directory. In this file, one can put all options to java virtual machine. To increase my memory amount i had to put there:


Only with that option, my Matlab 7.0 and my java program worked. I also tried solution at official matlab site: here. But it didn't work. I had to use all four parameters in order to run my program.

No comments:

Post a Comment