Bug 57585

Summary: memory optimization in JavaModelCache
Product: [Eclipse Project] JDT Reporter: Noel Grandin <noelgrandin>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: jerome_lanneluc
Version: 3.0   
Target Milestone: 3.1 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Noel Grandin CLA 2004-04-06 11:08:54 EDT
This is against M7.

Long periods of running eclipse with very large projects tends to result in 
quite a large amount of memory in use, which I traced (using OptimizeIt) to :

org.eclipse.jdt.internal.core.JavaModelCache

Consider using a WeakHashMap or similar memory sensitive cache for the Maps 
here.
Comment 1 Philipe Mulet CLA 2004-04-06 17:43:28 EDT
Thanks for the input. No promise we will change this for 3.0 release, but 
definitely good info. We could also reduce the size of the cache...

Comment 2 Noel Grandin CLA 2004-04-07 08:15:17 EDT
Note of that of the 4 Maps here, one is a subclass of OverflowingLRUCache, and 
the others are HashMaps.
That means that only one of them will stabilize in size, the others will just 
keep growing...

But I have noticed the 3.0 is considerably lighter ITO mem. usage than 2.x, so 
it's not like I'm terribly disappointed :-)
Comment 3 Jerome Lanneluc CLA 2004-05-19 11:31:11 EDT
Will consider post 3.0
Comment 4 Jerome Lanneluc CLA 2004-07-06 05:09:24 EDT
Reopening
Comment 5 Jerome Lanneluc CLA 2004-08-19 09:02:49 EDT
Changed JavaModelCache to use separate LRUCaches for projects, roots, packages 
and openables. (Note using WeakHashMap would not work as a reference from the 
parent would always exist).
Comment 6 Jerome Lanneluc CLA 2004-08-19 09:03:09 EDT
*** Bug 65272 has been marked as a duplicate of this bug. ***
Comment 7 Noel Grandin CLA 2004-08-19 09:30:09 EDT
Pity about the WeakHashMap. The reason I suggested that was that I was hoping 
to avoid the situation where the LRUCaches are sometimes too small and 
sometimes too big.

Sometimes I run Eclipse on RAM-constrained boxes with about 100-200 files in a 
workspace, normally to write testing/scripting code.

Other times I run on big boxes with projects that have ~7000 java files where I 
am quite happy to trade RAM for a snappier dev environment.
Comment 8 Jerome Lanneluc CLA 2004-08-19 09:36:43 EDT
Right. I entered bug 72258 to solve this issue.
Comment 9 Frederic Fusier CLA 2004-09-23 10:18:26 EDT
Verified for 3.1 M2 with build I200409230010.