Bug 285230

Summary: [performance] Duplicate buffers created for internal classes
Product: [Eclipse Project] JDT Reporter: Kelly Campbell <kellyc>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, jarthana, Olivier_Thomann, srikanth_sankaran
Version: 3.5Keywords: performance
Target Milestone: 3.6 M2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch to ClassFile.java and SourceMapper.java
john.arthorne: iplog+
Proposed fix + regression test none

Description Kelly Campbell CLA 2009-07-30 16:14:37 EDT
Created attachment 143082 [details]
Patch to ClassFile.java and SourceMapper.java

Build ID: 3.5.0 I20090611-1540

Steps To Reproduce:
1. Use a project with a mapped source jar containing a large .java file with many internal classes
2. Hit a breakpoint in the debugger which is in one of those classes

Eclipse freezes and encounters an OOM after several minutes.


More information:
Inspection of a heap dump using MAT shows that there is a duplicate Buffer and char[] containing the contents of the large java file for each internal class. For example, an 8MB java file containing 42 internal classes expands to 17MB char[] x 42 = 714MB of heap.

Preferably there would be only one Buffer for the java source file.

I'm attaching a patch which corrects this.
Comment 1 Olivier Thomann CLA 2009-08-18 19:15:59 EDT
Daniel,

Candidate for 3.5.1?
Comment 2 Olivier Thomann CLA 2009-08-18 19:16:51 EDT
Created attachment 144892 [details]
Proposed fix + regression test

Changed the submitted patch to prevent getting a source mapper if not needed.
Comment 3 Dani Megert CLA 2009-08-19 12:27:48 EDT
>Daniel,
>Candidate for 3.5.1?
Teh bug is bad but it doesn't seem to be a regression and the fix is non-trivial. For now I'd put it into 3.6 only.
Comment 4 Olivier Thomann CLA 2009-08-19 12:42:16 EDT
Will release for 3.6M2.
Comment 5 Olivier Thomann CLA 2009-08-26 12:02:31 EDT
Released for 3.6M2.
Regression test added in:
org.eclipse.jdt.core.tests.model.AttachSourceTests#testClassFileBuffer
Comment 6 Jay Arthanareeswaran CLA 2009-09-15 06:09:57 EDT
Verified for 3.6M2 using code inspection and regression tests verification.