Re: Is ImageJ memory-leaky?
Posted by Albert Cardona on Sep 14, 2005; 10:24am
URL: http://imagej.273.s1.nabble.com/Is-ImageJ-memory-leaky-tp3704878p3704880.html
Pedro,
ImageJ is not leaky that I know of, at all. Memory issues have to do with how
the java virtual machine works. This is not so different from C/C++: memory
has to be released at some point or your virtual machine will run out of RAM
space before it occurs to it to run a garbage collector.
So I recommend you insert code into your plugin that:
1) checks how much memory is available
2) if not enough for what you want to do, release it by calling in a
while(true) loop the garbage collector until enough memory has been released.
3) proceed with whatever memory-consuming task
ImageJ has in the ij.IJ class methods to tests the amount of available memory;
if you want to do it manually check the java.lang.System class
If this does not address your problem because your plugin actually uses all
that filled-up memory, try dynamic loading/unloading of memory: release what
you don't need at the moment and then reload it when it is needed. This way I
manage to deal with 6 GB of images at the same time in a 512Mb RAM machine.
Albert
--
Albert Cardona
Institute of Neuroinformatics Tel : +41 1 635 3052
University/ETH Zurich Fax : +41 1 635 3053
Winterthurerstrasse 190 acardona (at) ini phys ethz ch
Zurich 8057, Switzerland www.ini.unizh.ch