Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326411 - Moving a line using keyboard in css results in OutOfMemoryError.
Summary: Moving a line using keyboard in css results in OutOfMemoryError.
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.css (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.3 M5   Edit
Assignee: Rakesh CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2010-09-28 09:27 EDT by Iwao AVE! CLA
Modified: 2011-01-21 16:31 EST (History)
1 user (show)

See Also:
nsand.dev: review+


Attachments
CSS file to reproduce the problem (11.33 KB, text/css)
2010-09-28 09:29 EDT, Iwao AVE! CLA
no flags Details
Stack trace copied from the error log. (3.14 KB, text/plain)
2010-09-28 09:31 EDT, Iwao AVE! CLA
no flags Details
Simpler example file to reproduce the problem. (87 bytes, text/css)
2010-09-28 13:03 EDT, Iwao AVE! CLA
no flags Details
patch (1.59 KB, patch)
2010-09-30 01:14 EDT, Rakesh CLA
nsand.dev: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Iwao AVE! CLA 2010-09-28 09:27:38 EDT
Build Identifier: 20100917-0705

In a relatively large css file, OufOfMemoryError occurs when moving a line using keyboard shortcut (option + arrow key).
Increasing the max heap size (-Xmx1024m) seems not to help.

I will attach an example css and the stack trace.

Reproducible: Always

Steps to Reproduce:
1. Create a Static Web Project.
2. Copy the attached test.css in the WebContent folder.
3. Put the cursor at a line 5 (font-size:12px;) and hold down 'option key + down arrow key' to move the line continuously.

Before the line is moved to the bottom of the file (usually at line 117 on my environment), an 'Unhandled event loop exception' occurs.
Comment 1 Iwao AVE! CLA 2010-09-28 09:29:53 EDT
Created attachment 179738 [details]
CSS file to reproduce the problem
Comment 2 Iwao AVE! CLA 2010-09-28 09:31:24 EDT
Created attachment 179739 [details]
Stack trace copied from the error log.
Comment 3 Iwao AVE! CLA 2010-09-28 13:03:16 EDT
Created attachment 179765 [details]
Simpler example file to reproduce the problem.

Attached a smaller css file which causes the same OutOfMemoryError.
So, it seems that the size of the file does not matter.
Comment 4 Iwao AVE! CLA 2010-09-28 13:09:37 EDT
Forgot to mention how to reproduce the problem with the simpler css.
Move the second line (color:#F35B00;) down to line 5 using the keyboard shortcut (option + down).

I also found that if I insert a tab character at the top of the second line, the OufOfMemoryError does not occur.
Comment 5 Rakesh CLA 2010-09-30 01:14:16 EDT
Created attachment 179920 [details]
patch
Comment 6 Nick Sandonato CLA 2010-11-17 14:48:55 EST
Rakesh, I'm not sure if this patch will correct the reported issue. When holding down the Alt+Arrow Key, I never saw that ArrayList get larger than 4 elements, and all were unique. So I don't think using a HashSet is the solution.

I'm running at -Xmx512m, and even using the large css example, I cannot get the OutOfMemoryError by moving the line clear down to the bottom of the file. Are there any other details you can share with us? Maybe the heap dump file that was generated?

Thanks for your help.
Comment 7 Rakesh CLA 2010-11-17 23:25:03 EST
(In reply to comment #6)
> Rakesh, I'm not sure if this patch will correct the reported issue. When
> holding down the Alt+Arrow Key, I never saw that ArrayList get larger than 4
> elements, and all were unique. So I don't think using a HashSet is the
> solution.
> 
> I'm running at -Xmx512m, and even using the large css example, I cannot get the
> OutOfMemoryError by moving the line clear down to the bottom of the file. Are
> there any other details you can share with us? Maybe the heap dump file that
> was generated?
> 
> Thanks for your help.

Hi Nick, I was able to reproduce it again.
Try to move second line(color:#F35B00) in this simpler css:
Make sure that there is no tab or whitespace at that start of text.

.newmassage a:visited {
color:#F35B00;
}
.key {
float:left;
width:12px;
height:15px;
}

As soon as it reaches 5-th line, while loop in code just after the declaration 'List structures ' will become infinite , so amount of memory allocated doesn't make any difference.
Comment 8 Rakesh CLA 2011-01-20 00:34:25 EST
ping!
Comment 9 Nick Sandonato CLA 2011-01-21 16:30:46 EST
Code released to HEAD.