Closed karlduderstadt closed 2 years ago
The above commits, and perhaps one or two others that I forgot to add the issue number to, fix the main issue, so I will close this. However, care needs to be taken when writing scripts. For example, if you copy an object from one archive to another without actually making a deep copy, sometimes this causes problems for releasing that memory. Java works entirely using links, so most operations don't make a deep copy unless you do it explicitly. At the moment, I do not know of many of the main Mars commands or scripts have have this problem.
This problem could be expected when copying records from one archive to another. If written correctly, these scripts shouldn't cause memory leaks.
There is a large amount of memory from an archive that is not released when the window is closed. Over time this causes out of memory errors, slowing down of processing, and failure to complete commands.
When archives are opened without a UI and closed all memory is released. So the issue appears to be references to the archive in the javafx stage subpanes that are not released. To fix this issue, I am working through all the subpanes and checking that the all references to the archive and mars records are set to null. This appears to fix the issue.
I have added a event on window close and initialises the Molecule Archive to null. This should remove all references throughout all panes once NPE etc are fixed.
This is a major bug that must be fixed as soon as possible.