Community
Participate
Working Groups
Sapphire editors from an adopter product leave XmlEditorResourceStore.Scrubber threads that don't seem to terminate. Closing the SapphireEditor does not terminate the thread. Since the Scrubber thread doesn't terminate the and contains a reference to the XmlEditorResourceStore instance that created and started the thread. The XmlEditorResourceStore has references to the SapphireEditor and the root model and since the thread is not terminated and the reference to the XmlEditorResourceStore is maintained this causes memory leaks. Every time you open and close a file (even the same file) in the SapphireEditor, a new Scrubber thread is created, adding to the number of threads and memory consumed. The workbench call dispose() on the SapphireEditor and in turn disposes the model which frees up some objects. I noticed in various that the dispose method does not set the model reference to null and the XmlEditorResourceStore also still has the reference to the model as well as the editor so these and other objects are never collected. Using a memory analysis tool you can see the instances of each Scrubber thread, XmlEditorResourceStore, editor, model, etc that remain. Here's an example thread dump of a thread that remains after the editor has been closed. "Thread-27" prio=6 tid=0x048d7400 nid=0x11e0 waiting on condition [0x0614f000] java.lang.Thread.State: TIMED_WAITING (sleeping) at java.lang.Thread.sleep(Native Method) at org.eclipse.sapphire.ui.swt.xml.editor.XmlEditorResourceStore$Scrubber.run(XmlEditorResourceStore.java:479) - locked <0x0bce0000> (a org.eclipse.sapphire.ui.swt.xml.editor.XmlEditorResourceStore$Scrubber)
Fixed in 0.3.1 and 0.4 streams. Please verify.
verified fixed in 0.3.1, testing with the adopter product.
Thanks. Closing.