Open tinevez opened 3 years ago
This issue has been mentioned on Image.sc Forum. There might be relevant details there:
https://forum.image.sc/t/trackmate-does-not-free-up-ram-when-closing/54922/4
@tinevez I'm curious to know how you deal with this. Visualvm + eclipse MAT?
I am actually using the YourKit Java profiler, making a RAM snapshot.
Hum I am afraid I am failing big time on this one. I cannot manage to identify the culprit with my method. Still trying.
@tinevez Just a guess: is it possible that some JFrame
or JDialog
objects are not being disposed when closed? I see you have some setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE );
calls, but there are quite a few different new JFrame
and extends JFrame
invocations in TrackMate, most of which are not set to dispose on close.
I pushed a branch dispose-on-close
where I tried to set the default close operation to dispose for all frames I could quickly find. But I don't have time to test it now, sorry. Maybe you could try it and see if the memory leak persists?
Do you have any frames that you allow the user to toggle visibility by closing them temporarily? Like, they can press the X, but then another button elsewhere can show the frame again? If so, we'd need to do something more clever to dispose such frames at the proper time later.
I've got this:
A lambda in FilterGuiPanel
Maybe linked to a thread which is not stopped:
When butchering out the OnRequestUpdater
thread and the PainterThread
in WizardPanel
I get this chain:
Add after removing the ImagePlus keys in displayers
of SpotEditTool
:
Not sure this is going to end
If I track a 250MB image (one coming from the ISBI SPT challenge, VIRUS snr 7 density high) I see it at the end of the tracking. I document here quickly the RAM usage followed with the Monitor Memory tool (it is not relevant to check RAM usage from the Windows tool). Every value I report are the one reported by the tool after garbage collection. I used the devel version of TrackMate for the test.
Opening Fiji 43 MB
Opening the Image 295 MB
Launching TrackMate 480 MB
In the config panel of the LoG detector, after preview 310 MB (sigh)
If I close TrackMate UI and the image now, the RAM usage goes down to 58 MB, which is what we expect.
After full detection (diameter 5, threshold 50, no initial thresholding, I got about 100k spots), in the spot filter panel 530 MB
If I close TrackMate now, it does NOT give back the RAM. I still use 530 MB
So here is my memory leak.