Icy / virtual mode - cache memory : is it possible to manually wipe it?

dear all,

In a plugin we are currently developing to analyze our experiments, we are browsing through stacks of images, displaying / analyzing one stack after another. To do so, I have implemented a list of sequences as a JComboBox, allowing users to go from one stack to the other, and/or to analyze either single stacks or a whole range of stacks.

Behind the scene, the stack images are loaded into a sequence according to the procedure described in an earlier message on this discussion (“Loading images / creating sequence is SLOW”), which basically feeds into a sequence the first image of the stack and then add all images one by one in a separate thread, making them virtual.

This works well for a few stacks that do not contain to much images, but with 24 stacks of 240 images, I a quickly using up to 8 Gb memory. Each time a new stack is selected, the memory use goes up and does not return back, or I see saw-like patterns in the memory use. More, when I close the stacks but leave my plugin open, the memory takes ages to be liberated and during a while, I see activity that looks related to the cache. And it takes 1 or 2 GC (double clicking on the lower right window of Icy) to get the memory use down.

I suppose that the cache is still having the numerous files declared and continues to feed in and out the corresponding files.

Is there a way to freeze the cache and clean it from the files previously fed into it that I know not being needed anymore?

Thank you in advance for any help,

Frederic

Dear Frederic,

With the last version, you normally don’t need to use the method you used to load the Sequence, which was kind of workaround of the slow metadata parsing of Icy. The inconvenient of this method is that it will always load all the images in background even if you don’t use / process the full stack and so that will definitely overload the cache engine, and the loader thread itself can take sometime to load all the images in the Sequence. That can explain why you see memory not going low immediately even if you close your plugin. I recommend you to try to get back to the old method (just using the Loader method), the difference is that image loading is done on demand, so if you select a stack but you don’t process it or visualize it, it won’t load the image data thus making the process smoother in general.
About the specific question of wiping the cache, this is normally done automatically. As soon you close a Sequence, the cache should evict all data from the Sequence. But here the problem is that the Sequence is still maintained by your thread which is still processing the image loading operation i guess.

– Stephane

1 Like

dear Stephane,

this works very well indeed. And it solves problems I encountered when analyzing series of data, because of synchronizing the threads created when reading the data!

So, again, MANY thanks,
Frederic

2 Likes