I am trying to use the python-bioformats package to read from a .ims image file. On reading a large number of slices a memory leak accumulates eventually causing an out of memory error.
The following code gives a minimal example of the leak
data = "/data/data.ims"
with bioformats.ImageReader(data) as reader:
for i in range(10)
slice = reader.read(z=10)
As I understand it, the preferred use is to bind the reader to a scope like this. I have also tried simply calling .close() afterwards instead. This code causes the Python process to accumulate a large amount of memory usage (increasing on each iteration). Killing the VM does not free the memory and the memory is only freed once the python process has ended.
Any ideas would be greatly appreciated.