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.
This bug was originally marked as duplicate of bug 223619, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related. Build: NetBeans IDE 7.3 (Build 201302132200) VM: Java HotSpot(TM) 64-Bit Server VM, 20.5-b03, Java(TM) SE Runtime Environment, 1.6.0_30-b12 OS: Windows 7 User Comments: Alniks: tried to open big log file in nb Stacktrace: java.lang.OutOfMemoryError: Java heap space at org.netbeans.modules.editor.lib2.document.ReadWriteUtils.read(ReadWriteUtils.java:74) at org.netbeans.editor.BaseDocument.read(BaseDocument.java:1433) at org.netbeans.editor.BaseKit.read(BaseKit.java:707) at org.openide.text.DataEditorSupport.loadFromStreamToKit(DataEditorSupport.java:487) at org.openide.text.CloneableEditorSupport.loadDocument(CloneableEditorSupport.java:2196) at org.openide.text.CloneableEditorSupport.access$2700(CloneableEditorSupport.java:129)
Created attachment 134134 [details] stacktrace
org.netbeans.modules.editor.lib2.document.ReadWriteUtils.read() can be improved to use less memory especially for large files.
Created attachment 140889 [details] stacktrace I was loading a large text file. I thought it was 15 mb but it was 150mb.
Created attachment 145480 [details] stacktrace .
Created attachment 150621 [details] stacktrace Start IDE
166 duplicates -> P2
Created attachment 151900 [details] stacktrace opening a large text file (207MB)
Created attachment 152734 [details] stacktrace Opening a large file (976mb)
Alghough the editor document implementation is capable of repetitive insertions upon document read all the document listeners are triggered upon each insertion (including e.g. lexer's relexing etc.). So ReadWriteUtils.read() attempts to fully read the stream so that just a single insert is made which should be the most efficient approach. As the ReadWriteUtils.read() can perform several memory allocations it's often shown in OOMEs but it does not itself leak the memory. All the current editor's memory leaks should be resolved in terms of issue #239360 so making this issue a dup of it. *** This bug has been marked as a duplicate of bug 239360 ***