Login  Register

Re: Is ImageJ memory-leaky?

Posted by Albert Cardona on Sep 14, 2005; 5:47pm
URL: http://imagej.273.s1.nabble.com/Is-ImageJ-memory-leaky-tp3704878p3704879.html

Pedro,

There are many ways to dynamically load/unload RAM memory, in this case
images. A very nice and straightforward example is found in the
Virtual_Stack_Opener.java plugin by Wayne, at
http://rsb.info.nih.gov/ij/plugins/virtual-opener.html

The way I do it for my purposes is to wrap the object to be loaded/unloaded in
a wrapper class to which all calls to that object are piped. So when the
object is required, the wrapper class first makes some space by telling the
cache to do so, loads it either from scratch (as the files in the Virtual
Stack Opener) or from the cache, and then sends it to the cache for storing.
The cache keeps a first-in-first-out queue of the objects and self-regulates
itself to make space, releasing as many of the least-used objects first (the
older ones in the queue) as needed.

Hope it helps.

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