usnistgov / pyramidio

Image pyramid reader and writer
Other
33 stars 22 forks source link

significant memory leak when maxImageCachePercentage > 0 #15

Open martyvona opened 3 years ago

martyvona commented 3 years ago

I am pretty sure that you need to set imageReaderCache = null before TileBuilderTask.compute() returns. As it is, the four tasks created around line 205 in TileBuilder.java will all hold references to their imageReaderCache instances simultaneously, effectively using 4 times the intended amount of memory.

All their descendant tasks will also reference those imageReaderCache instances too, and the ForkJoinPool will apparently continue to reference all the tasks, even after they are done computing. Which is why I suggest this be solved by setting imageReaderCache = null individually for each task just before TileBuilderTask.compute() returns.

this only matters if maxImageCachePercentage > 0.