increasing memory allocation via Java code

2 messages Options
Embed this post
Permalink
Roy Wollman

increasing memory allocation via Java code

Reply Threaded More More options
Print post
Permalink
Hi All,

I'm trying to import few of the ImageJ classes to use within matlab.
Matlab has great java support which basically means that I can create
objects on the command line (e.g. stk=imp.createEmptyStack();).

However, the maximal memory allocation is too low. Since I'm running
on a OS-X with 64-bit and lots of memory I want to increase the
maximal memory allocation. I already don't so in the standalone
ImageJ64 application and it works great.

Here is the matlab code I'm using:

javaaddpath /Applications/ImageJ/ImageJ64.app/Contents/Resources/Java/ij.jar
import ij.*;
mem=ij.plugin.Memory;
mem.run('');

Than I get the menu in which I change the total memory but.... I get
the following message:

ImageJ is unable to change the memory limit. For
more information, refer to the installation notes at

    http://rsb.info.nih.gov/ij/docs/install/

The ImageJ application (ImageJ.app) was not found.

Current limit: 189MB

Since the java objects are created within matlab its not my job to
worry about memory management but matlab's problem. Is there another
way to increase the limit or just disable the memory limit altogether?

Thanks,
Roy
Nico Stuurman-4

Re: increasing memory allocation via Java code

Reply Threaded More More options
Print post
Permalink
Hi Roy,

> I'm trying to import few of the ImageJ classes to use within matlab.
>
> Since the java objects are created within matlab its not my job to
> worry about memory management but matlab's problem. Is there another
> way to increase the limit or just disable the memory limit altogether?

It is matlab's problem indeed.  There is a long write up at the  
mathworks about how to set the JVM memory limit:

http://www.mathworks.com/support/solutions/en/data/1-18I2C/index.html

Best,

Nico