Growing Memory Issues in Fiji

Hello again,

Hoping that this is the last of my problems for the time being, as this is (I believe) the last thing from allowing me from implementing all of my work the way I set out to.

Within pyimagej I am opening images with ij.openImage()

I am able to manipulate and work with these images to my hearts content, but doing this iteratively is not an option. Closing the working images does not free their memory back to ImageJ. Every image opened is acting cumulatively with the previous images opened.

I have looked into this topic here, here and here. However, I have yet to spot a particularly clear solution.

Images opened and closed via the gui behave predictably, and their memory is freed as soon as their window is closed, but images opened in pyimagej are not showing the same courtesy.

I’ve given it a few shots in the dark and attempted closing images manually via .close(), WindowManager.closeAllWindows(), ij.window().clear(). I’ve also tested manually triggering garbage collection in the gui, but that does not solve the issue. It was surmised within the posted threads that changing the type of garbage collector would likely not solve the issue but I gave it a shot anyway just as a test. scyjava_config.add_options('-XX:+UseParNewGC') helped a little bit (reclaimed ~2%), but clearly did not solve the underlying issue.

Any help is always appreciated and I’m happy to provide more details if prompted.

1 Like