Re: out of memory: multiple images

Posted by Volker Baecker on
URL: http://imagej.273.s1.nabble.com/out-of-memory-multiple-images-tp3702323p3702325.html

Hi,
x0=newArray(nBlobs); will use new memory, however if there's no other
reference to the "old content" of x0, the memory containing the old
content will be given back by the garbage collector.
And this might be the problem. If you have a tight loop the garbage
collector may never be able to run. Try to force a garbage collection at
the beginning of the loop using IJ.freeMemory(). You can print the
string you get back from the method to see what happens to the memory.
Cheers,
Volker


Martin du Saire a écrit :

> Hi,
>
> I am running a macro containing a bunch of user-defined functions in
> BatchMode on a entire directory of 35kb images.  The macro makes it
> through about 160 images before ImageJ reports "out of memory".  I am
> sure I am closing all the intermediate and the resulting images in
> each loop, and the only output other than the resulting image, is a
> couple lines in "Log" per image.  Any ideas?  Does ImageJ create new
> versions of variable, arrays etc. each time the process is run?
>
> For example, does "x0=newArray(nBlobs);" create a separate array each
> time it is called, or does it overwrite x0?
>
> Thanks.
>
> M
>

--
passerelle antivirus du campus CNRS de Montpellier
--