Posted by
Martin du Saire on
URL: http://imagej.273.s1.nabble.com/out-of-memory-multiple-images-tp3702323p3702326.html
Uh, I think the problem has been resolved. I inserted:
print("Free memory:", call("ij.IJ.freeMemory")); // returns a string
at the beginning of the loop. It reported that
1% of the 300Mb was free. This is reported at
the beginning of the macro, prior to opening any
images! Is that the expected result? Anyway, I
ran through a directory with 180 (34kb on disk)
images with no problem. So, then I commented out
the line, and ran the macro again: No problem. Go figure...
If ImageJ tries to grab the 300mb for itself a
the outset, could come into conflict with higher
priority processes at some point, and thus report that it is out of memory?
For the record: ImageJ1.37h Java1.0.5 on XP
Thanks.
Martin
At 02:44 AM 7/3/2006, you wrote:
>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
>--