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.
It would be nice to keep just a weak reference to CloneableEditorSupport document and allow it to be freed from memory when nobody needs it (not modified, no references to it). This would simplify the situation when somebody get the document and now he does not know whether to close it or leave open. With proper GC he could just leave it alone and it would be freed automatically.
Created attachment 12634 [details] Sample test and initial implementation
Created attachment 12639 [details] Another test: document should not disappear when it is modified
Can you evaluate, please? Estimated schedule?
Not as simple as it seems. Please take into account locking issues and intarnal state machines that needs to be consistent with real document availability.
Is not post beta2 the right time to work on this fix?
weak_dokument_38218 branch created in openide/text and it contains basic implementation.
We'd like to see this issue fixed in 6.0. Refactoring must handle possibly hundreds of documents, which might stay open in memory.
At your wish, Jan! #38218: CloneableEditorSupport holds its document via weak references, so it can disappear from memory when no longer needed DE:------------------------------------------------- IDE: [18.10.07 13:32] Committing started Checking in test/unit/src/org/openide/text/Deadlock56413Test.java; /shared/data/ccvs/repository/openide/text/test/unit/src/org/openide/text/Deadlock56413Test.java,v <-- Deadlock56413Test.java new revision: 1.5; previous revision: 1.4 done Checking in test/unit/src/org/openide/text/CloneableEditorSupportTest.java; /shared/data/ccvs/repository/openide/text/test/unit/src/org/openide/text/CloneableEditorSupportTest.java,v <-- CloneableEditorSupportTest.java new revision: 1.9; previous revision: 1.8 done Checking in src/org/openide/text/LineListener.java; /shared/data/ccvs/repository/openide/text/src/org/openide/text/LineListener.java,v <-- LineListener.java new revision: 1.4; previous revision: 1.3 done Checking in src/org/openide/text/CloneableEditorSupport.java; /shared/data/ccvs/repository/openide/text/src/org/openide/text/CloneableEditorSupport.java,v <-- CloneableEditorSupport.java new revision: 1.41; previous revision: 1.40 done Checking in src/org/openide/text/PositionRef.java; /shared/data/ccvs/repository/openide/text/src/org/openide/text/PositionRef.java,v <-- PositionRef.java new revision: 1.6; previous revision: 1.5 done Checking in src/org/openide/text/NbDocument.java; /shared/data/ccvs/repository/openide/text/src/org/openide/text/NbDocument.java,v <-- NbDocument.java new revision: 1.7; previous revision: 1.6 done Checking in src/org/openide/text/DocumentLine.java; /shared/data/ccvs/repository/openide/text/src/org/openide/text/DocumentLine.java,v <-- DocumentLine.java new revision: 1.8; previous revision: 1.7 done IDE: [18.10.07 13:32] Committing finished