This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I have realized that once a XMLDataObject is instantiated a XMLSyncSupport holding a reference to EditorSupport is created a associated to it. So since the EditorSupport holds a strong reference to NbEditorDocument the editor document is never GCed until the DataObject lives (which is until it Node lives, which is almost forever). Due to this reference chain the editor document instance is leaking for each XMLDataObject which "content" was opened in the editor. This leak is here for a long time and AFAIK noone complained much about it since the amount of the memory held by one XMLDO is not critical. A problem appears now when the XMLDocumentModel has been introduced and associated to the NbEditorDocument once an user opens a navigator or enables the code folding for a XML document. The model references a lot of objects and is not GCed until the NbEditorDocument lives ...
Created attachment 26823 [details] The DO -> editor document refs. chain
partially fixed - I didn't fixed the described leak itself but made the NbEditorDocument -> DocumentModel reference weak so the DocumentModel instance is GCed when there is only the editor holding it. I have verified in the profiler that the leak is much smaller now. Downgrading to P3. Checking in xml/tageditorsupport/src/org/netbeans/modules/editor/structure/api/DocumentModel.java; /cvs/xml/tageditorsupport/src/org/netbeans/modules/editor/structure/api/DocumentModel.java,v <-- DocumentModel.java new revision: 1.15; previous revision: 1.14 done Checking in xml/text-edit/src/org/netbeans/modules/xml/text/navigator/XMLNavigatorPanel.java; /cvs/xml/text-edit/src/org/netbeans/modules/xml/text/navigator/XMLNavigatorPanel.java,v <-- XMLNavigatorPanel.java new revision: 1.7; previous revision: 1.6 done
Created attachment 26847 [details] XMLDataObject -> DocumentListener -> TextEditorSupport -> NbEditorDocument leak references graph
Created attachment 26853 [details] After removing the mentioned strong references chain there is a new one - via XMLSyncSupport
fixed + implemented a XML navigator panels cache The leak was caused by the XMLDataObject synchronization support which didn't released XMLTextRepresentation object when the XML navigator was shown for a XML file without opening it. Checking in xml/core/src/org/netbeans/modules/xml/core/text/TextEditorSupport.java; /cvs/xml/core/src/org/netbeans/modules/xml/core/text/TextEditorSupport.java,v <-- TextEditorSupport.java new revision: 1.28; previous revision: 1.27 done Checking in xml/tageditorsupport/src/org/netbeans/modules/editor/structure/api/DocumentModel.java; /cvs/xml/tageditorsupport/src/org/netbeans/modules/editor/structure/api/DocumentModel.java,v <-- DocumentModel.java new revision: 1.16; previous revision: 1.15 done Checking in xml/text-edit/src/org/netbeans/modules/xml/text/navigator/NavigatorContent.java; /cvs/xml/text-edit/src/org/netbeans/modules/xml/text/navigator/NavigatorContent.java,v <-- NavigatorContent.java new revision: 1.18; previous revision: 1.17 done Checking in xml/text-edit/src/org/netbeans/modules/xml/text/navigator/XMLNavigatorPanel.java; /cvs/xml/text-edit/src/org/netbeans/modules/xml/text/navigator/XMLNavigatorPanel.java,v <-- XMLNavigatorPanel.java new revision: 1.8; previous revision: 1.7 done
Verifying on behalf of Marek. It would be embarrassing if one bug would be reported, fixed and verified by single person.