Bug 285230 - [performance] Duplicate buffers created for internal classes
Summary: [performance] Duplicate buffers created for internal classes
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.6 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2009-07-30 16:14 EDT by Kelly Campbell CLA
Modified: 2010-05-27 17:49 EDT (History)
4 users (show)

See Also:


Attachments
Patch to ClassFile.java and SourceMapper.java (3.56 KB, patch)
2009-07-30 16:14 EDT, Kelly Campbell CLA
john.arthorne: iplog+
Details | Diff
Proposed fix + regression test (5.52 KB, patch)
2009-08-18 19:16 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.