Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 185586 - Cannot open 12Mb file in the editor in 512Mb heap
Cannot open 12Mb file in the editor in 512Mb heap
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Parsing & Indexing
6.x
PC Solaris
: P2 with 1 vote (vote)
: 6.x
Assigned To: Vitezslav Stejskal
issues@editor
: PERFORMANCE
Depends on: 152491
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-06 08:00 UTC by Alexander Simon
Modified: 2010-05-19 06:20 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
test project (730.78 KB, application/x-gzip)
2010-05-06 08:00 UTC, Alexander Simon
Details
introduce Compose4 (5.45 KB, patch)
2010-05-06 09:22 UTC, Alexander Simon
Details | Diff
fixed patch (5.45 KB, patch)
2010-05-06 10:16 UTC, Alexander Simon
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Simon 2010-05-06 08:00:03 UTC
Created attachment 98540 [details]
test project

Test case:
- open attached project
- open newfile.cpp
- go to by hyper link on "IAdvancedSelectionCriteria"
- sldworks.h is opened
- see OOM after some moving in the file
Comment 1 Alexander Simon 2010-05-06 09:21:30 UTC
first obvious memory improvement is:
- finish optimization of AttributesUtilities$BigComposite by creating Composite4
It reduces objects size from 38Mb to 22Mb (saves 16Mb)
See patch
Comment 2 Alexander Simon 2010-05-06 09:22:19 UTC
Created attachment 98546 [details]
introduce Compose4
Comment 3 Alexander Simon 2010-05-06 10:02:52 UTC
Next obvious memory improvement is:
- keep in memory only 1 buffer with file text.
Actually editor has 3 buffers that consume 72Mb.
So it can reduce memory consumption on 48Mb.
This is list of fields with different instances of file text:
- org.netbeans.modules.parsing.api.Snapshot.text
- org.netbeans.editor.BaseKit$DefaultSyntax.buffer
- org.netbeans.editor.DocumentContent.charArray
By the way, why exists Snapshot in C/C++ project? CND does not use parsing API.
Comment 4 Alexander Simon 2010-05-06 10:16:18 UTC
Created attachment 98554 [details]
fixed patch
Comment 5 Miloslav Metelka 2010-05-06 12:26:13 UTC
 org.netbeans.editor.BaseKit$DefaultSyntax.buffer
should certainly be eliminated. It could possibly be because of syntax instances caching - I'll remove the caching ASAP.

I have an idea for AttributeSets memory reduction but I have to do some experiments first (not for 6.9). In the meantime I'm ok with Compose4. Vito, what do you think?
Comment 6 Miloslav Metelka 2010-05-10 10:15:41 UTC
Removed Syntax caching in BaseDocument:
http://hg.netbeans.org/jet-main/rev/27855e054de7
Comment 7 Miloslav Metelka 2010-05-11 07:37:56 UTC
Added AttributesUtilities.Composite4
http://hg.netbeans.org/jet-main/rev/af40fde644ad
Comment 8 Quality Engineering 2010-05-12 04:13:45 UTC
Integrated into 'main-golden', will be available in build *201005112200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:
Comment 9 Vladimir Voskresensky 2010-05-12 16:08:20 UTC
Mila, there is one more unneded text.
It is Snapshot for file. Open any C++ file
org.netbeans.modules.parsing.api.Snapshot object is created
due to CursorSensitiveScheduler which creates org.netbeans.modules.parsing.api.Source uncoditionally for each opened editor
Comment 10 Vitezslav Stejskal 2010-05-12 16:20:20 UTC
(In reply to comment #9)
> Mila, there is one more unneded text.
> It is Snapshot for file. Open any C++ file
> org.netbeans.modules.parsing.api.Snapshot object is created
> due to CursorSensitiveScheduler which creates
> org.netbeans.modules.parsing.api.Source uncoditionally for each opened editor

I'll have a look.
Comment 11 Vitezslav Stejskal 2010-05-13 21:18:29 UTC
http://hg.netbeans.org/jet-main/rev/71c08e172c8c - no Snapshot is created for C/C++ files. Even with this patch I still was not able to successfully open sldworks.h with -Xmx512m. There was OOME from o.n.m.cnd.editor.folding.CppFile, which makes a copy of the document as well.
Comment 12 Vladimir Voskresensky 2010-05-13 21:26:29 UTC
(In reply to comment #11)
> http://hg.netbeans.org/jet-main/rev/71c08e172c8c - no Snapshot is created for
> C/C++ files. 
Vita, thanks.

> Even with this patch I still was not able to successfully open
> sldworks.h with -Xmx512m. There was OOME from o.n.m.cnd.editor.folding.CppFile,
> which makes a copy of the document as well.
this is because you don't have yet changes made in our repository, i.e.:
http://hg.netbeans.org/cnd-main?cmd=changeset;node=04f15771c029
http://hg.netbeans.org/cnd-main?cmd=changeset;node=bb3cc5456927
http://hg.netbeans.org/cnd-main?cmd=changeset;node=2fa63b52bec7
Comment 13 Quality Engineering 2010-05-14 04:08:18 UTC
Integrated into 'main-golden', will be available in build *201005132200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:
Comment 14 Quality Engineering 2010-05-19 06:20:08 UTC
Integrated into 'main-golden', will be available in build *201005182201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo