Bug 27318 - single cut/undo allocates 2Mb of garbage of char[]
Summary: single cut/undo allocates 2Mb of garbage of char[]
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2002-11-28 09:32 EST by Adam Kiezun CLA
Modified: 2002-12-10 12:41 EST (History)
0 users

See Also:


Attachments
cut, undo (3.16 KB, text/plain)
2002-11-28 09:34 EST, Adam Kiezun CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2002-11-28 09:32:59 EST
20021127
in a large file (SWT.java)
i cut something from within a comment and undid the action
it allocated a lot of objects - including 3Mb of char[]
attached is allocation backtrace

seems like calling codeselect allocates a lot of stuff - maybe unnecessarily or 
maybe we could avoid calling it on every keystroke
Comment 1 Adam Kiezun CLA 2002-11-28 09:34:19 EST
Created attachment 2562 [details]
cut, undo
Comment 2 Adam Kiezun CLA 2002-12-09 11:59:41 EST
The memory is allocated by ICompilationUnit.codeSelect(). There is a bug report 
for this (bug 27321). 

But from looking at the code it seems that the result of the method 
getCurrentTextRegion isn't used in keyPressed. So may be the call can be 
removed?
Comment 3 Adam Kiezun CLA 2002-12-10 06:03:27 EST
cannot reproduce this problem anuymore
the code in JavaEditor.MouseClickListener.keyPressed is still problematic 
however (looks like the last follwoing lines can simply be removed - nothing 
seems to be done with the their result)

			ISourceViewer viewer= getSourceViewer();
			if (viewer == null)
				return;
			
			IRegion region= getCurrentTextRegion(viewer);
			if (region == null)
				return;

Comment 4 Kai-Uwe Maetzel CLA 2002-12-10 12:41:43 EST
Code changed as proposed in build > 20021210.