morphonets / SNT

The ImageJ framework for quantification of neuronal anatomy
https://imagej.net/plugins/snt
GNU General Public License v3.0
41 stars 17 forks source link

Memory leak after SNT is closed ? #208

Closed NicoKiaru closed 9 months ago

NicoKiaru commented 10 months ago

Describe the bug It looks like the memory is not released after SNT is stopped.

To Reproduce Look at memory occupation ( ~60 Mb) on a fresh start. Open SNT with a ~400Mb image, trace bunch or neurons (optional?). Close SNT. Look at memory: there's still 400 Mb occupied.

Expected behavior I think the memory should go back to a lower value.

Screenshots I've done a mem dump with visual VM and it looks like a hashmap in SNT retains most of the memory:

image

tferr commented 10 months ago

Thanks a lot for the report, @NicoKiaru! It looks like this is the culprit. @carshadi, would you have time to look into it?

carshadi commented 10 months ago

I'll take a look

carshadi commented 10 months ago

@tferr this should be improved in #209 . The SNT plugin itself is not garbage collected presumably since several components hold references to it even after the UI is closed. However, after these changes, the plugin instance only occupies ~2KB after closing the UI.

tferr commented 9 months ago

This should now be fixed and #209 has been merged into main. However, since are now compiling with Java 11, this will only be released when Fiji Java 11 becomes available. I am not sure when that will be. Hopefully soon!!