Bug 90182 - Java editor garbage creation
Summary: Java editor garbage creation
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: investigate, performance
: 127111 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-04 12:20 EDT by John Arthorne CLA
Modified: 2020-03-30 10:51 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2005-04-04 12:20:57 EDT
Build: 3.1 M6

Test case:

1) Open new workspace, switch to Java perspective
2) Leave all settings as out of box default, except turn autobuild off
3) Import org.eclipse.swt plugin
4) Open Java editor on StyledText.java
5) Close editor, run garbage collector several times
6) Snapshot heap
7) Open Java editor on StyledText.java
8) Snapshot heap

More than 100MB of objects are allocated.  Here are the main culprits:

Class      Instances     Size
---------------------------------
char[]      161,742    30,657 KB
Object[]    364,524    28,370 KB
StyleRange  435,825    20,429 KB
Region      313,712     9,803 KB
String      112,708     4,402 KB
text.Line    48,277     1,577 KB

Note 1: this source file is 262 KB, so more StyleRange instances are created
than bytes in the file.  Although 48,000 instances of jface.text.Line are
created, the file has less than 8,000 lines.

After several garbage collections, the memory overhead is much better:

Class      Instances     Size
---------------------------------
char[]       33,566     2,514 KB
Object[]     31,112     2,265 KB
StyleRange   55,781     2,614 KB
Region            1        32 bytes
String       15,315       598 KB
text.Line    14,284       557 KB

Why does it matter how much garbage is created?  The amount of memory allocated
from the OS by the VM largely depends on "peak" memory usage.  Opening editors
is one such peak period.  If we can reduce the amount of memory allocated during
peak memory usage periods, we decrease (or avoid increasing) the total memory
allocated to Eclipse by the operating system.  This in turn decreases OS memory
swapping, etc.
Comment 1 John Arthorne CLA 2005-04-04 12:23:18 EDT
I missed a step in the creation of my test case:

1a) Close *all* views, leaving only the editor area taking the entire
perspective. I wanted to capture only the memory allocated by the editor, not by
other views. 

Also, I opened the Java editor in step 7) using the history list in the File
menu, to avoid any possible memory interference by the types cache and indexer.
Comment 2 Dani Megert CLA 2006-02-09 12:53:07 EST
*** Bug 127111 has been marked as a duplicate of this bug. ***
Comment 3 Dani Megert CLA 2006-03-25 10:12:07 EST
Has to be shifted to 3.3. This is something which reaches deep into the text APIs.
Comment 4 Eclipse Genie CLA 2020-03-30 10:51:19 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.