Bug 179275 - [search] JavaWorkspaceScope caches all projects and does not refresh
Summary: [search] JavaWorkspaceScope caches all projects and does not refresh
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2007-03-26 06:33 EDT by Markus Keller CLA
Modified: 2008-03-26 05:15 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-03-26 06:33:35 EDT
I20070323-1616

- org.eclipse.core.expressions and org.eclipse.core.expressions.tests from CVS
- close o.e.c.e.tests
- search for references to type ExpressionInfo in Workspace
=> 41 refs

- open o.e.c.e.tests
- in Search view, press F5 (context menu > Search Again)
=> still 41 refs
=> expected: all 87 refs
Comment 1 Markus Keller CLA 2007-03-28 05:58:33 EDT
The problem is probably that JavaWorkspaceScope caches all projects from the workspace and does not refresh after it has been created.

In my workspace, such a workspace scope object uses about 65K memory. If IJavaSearchScopes are considered heavyweight and become invalid when the workspace changes, this should be documented and clients should be asked not to store such objects (cf. Javadoc of ASTParser.setResolveBindings(boolean): "So it is very important to not retain any of these objects longer than absolutely necessary").

Moving to core for comments.
Comment 2 Markus Keller CLA 2007-04-11 15:23:05 EDT
The caching is a memory problem for clients like Java search, whose ElementQuerySpecification holds on to IJavaSearchScope for a long time.
Comment 3 Frederic Fusier CLA 2008-02-28 10:55:15 EST
While searching for references on workspace using the menu item, this is not a JavaWorkspaceScope which is used to perform the request but a JavaSearchScope instead as the JRE is excluded from the scope in this use case...

This explain the observed behavior as the scope is not rebuild while using Search -> Again item but uses the one stored in QuerySpecification object.

It works as expected if I launch the same search using the Java Search dialog page including the JRE: I get the 100 results (with 3.4 M5) after having opened o.e.c.e.tests and redo the search using Search -> Again item...
Comment 4 Martin Aeschlimann CLA 2008-02-29 05:59:45 EST
What about the performance issue?


Comment 5 Martin Aeschlimann CLA 2008-02-29 07:10:05 EST
Oh, I assume that's bug 182738. Just saw you're working on it.
Comment 6 Frederic Fusier CLA 2008-02-29 07:45:34 EST
(In reply to comment #5)
> Oh, I assume that's bug 182738. Just saw you're working on it.
> 
Right
Comment 7 Eric Jodet CLA 2008-03-26 05:15:27 EDT
Verified for 3.4M6 using build I20080324-1300