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.

Bug 38218

Summary: GC documents from memory when not needed
Product: platform Reporter: Jaroslav Tulach <jtulach>
Component: TextAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: blocker CC: issues, jbecicka, jlahoda, phrebejk, pkuzel, pnejedly, rkubacki
Priority: P3 Keywords: PERFORMANCE
Version: 3.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 38476    
Attachments: Sample test and initial implementation
Another test: document should not disappear when it is modified

Description Jaroslav Tulach 2003-12-18 17:25:04 UTC
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.
Comment 1 Jaroslav Tulach 2003-12-18 17:25:50 UTC
Created attachment 12634 [details]
Sample test and initial implementation
Comment 2 Jaroslav Tulach 2003-12-19 09:10:59 UTC
Created attachment 12639 [details]
Another test: document should not disappear when it is modified
Comment 3 _ pkuzel 2004-01-27 17:52:29 UTC
Can you evaluate, please? Estimated schedule?
Comment 4 Petr Nejedly 2004-01-28 14:06:54 UTC
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.
Comment 5 Jaroslav Tulach 2007-10-18 08:35:54 UTC
Is not post beta2 the right time to work on this fix?
Comment 6 Jaroslav Tulach 2007-10-18 10:33:50 UTC
weak_dokument_38218 branch created in openide/text and it contains basic implementation.
Comment 7 Jan Becicka 2007-10-18 10:49:44 UTC
We'd like to see this issue fixed in 6.0. Refactoring must handle possibly hundreds of documents, which might stay open
in memory.
Comment 8 Jaroslav Tulach 2007-10-18 12:33:30 UTC
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