[Bug 463715] [Debugger] A debug engine is not garbage collected after termination
Bugzilla Link | 463715 |
Status | ASSIGNED |
Importance | P3 normal |
Reported | Apr 01, 2015 13:57 EDT |
Modified | Apr 03, 2015 05:19 EDT |
See also | Gerrit change https://git.eclipse.org/r/45213, Git commit 2f41bee3 |
Reporter | Andreas Wallner |
Description
After a script stops running in debug mode, objects that were instanciated in the script will not be cleaned up. This is especially a problem if one does e.g. file handling and not all exceptions are cought. In such a case a file might stay locked, even though the script finished running.
Looking at the memory dump of the running eclipse instance (with Memory Debugger) it seems the cause here is that org.eclipse.ease.lang.javascript.rhino.debugger.RhinoDebugger has a member mLastScript, which contains the scope of the script, and therefore also all objects created in the script (and not yet cleaned up).
Steps to reproduce:
- write script that instanciates e.g. a FileOutputStream, and e.g. raises after the instanciation
- debug script
- look at the memory image and find that the output stream was not collected
(the output stream is conveninent here since one can search for the file name used)
Workaround:
Simply write a script that cleans up correctly after itself (try/finally...)
It would still be nice if this was cleaned up...