Bug 47631 - PerThreadObject (JavaModelManager.deltaState) leaks Threads.
Summary: PerThreadObject (JavaModelManager.deltaState) leaks Threads.
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-27 08:51 EST by Thomas M??der CLA
Modified: 2003-12-17 10:12 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas M??der CLA 2003-11-27 08:51:10 EST
Here's my scenario:

1) Open a .java file (opens CompilationUnitEditor)
2) Close the editor.
3) observe: there's still an instance of the CompilationUnitEditor hanging around.

With a mem profiling tool, I could see that there is a reference chain like this:

JavaModelManager->deltaState->deltaProcessors->internalMap->....key->AbstractReconciler$BackgroundThread->JavaReconciler

Note that the reconciling thread has been terminated by that time. I'd expect
per thread objects to go away when the thread ends (use a weak map, perhaps?)
Comment 1 Philipe Mulet CLA 2003-11-27 10:04:29 EST
Good find. 2 issues:
- we should convert to ThreadLocal which is tighlty integrated with Thread 
support and will ensure references are at least disposed when the thread dies.

- check whether we are not forgetting to release the offending reference at an 
earlier stage. 
Comment 2 Philipe Mulet CLA 2003-11-27 10:19:39 EST
Converted to ThreadLocal. 

Reconciling path is never clearing the delta processor per thread cache 
(mistake) since it intends to reuse it across reconciliations. Will rely on 
thread dying to get rid of cached delta processor.

Fixed
Comment 3 Philipe Mulet CLA 2003-11-29 07:19:30 EST
Verified under profiler that closing all editors (which had reconciled) leaves 
no instance of JavaReconciler.
Comment 4 David Audel CLA 2003-12-17 10:12:26 EST
Verified for 3.0M6