Bug 33927 - Leak in Java Editor
Summary: Leak in Java Editor
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 critical (vote)
Target Milestone: 2.1 RC3   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 33922 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-05 18:04 EST by Kevin Haaland CLA
Modified: 2003-03-20 08:16 EST (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 Kevin Haaland CLA 2003-03-05 18:04:10 EST
In 03/04 build 

Import all projects as binary projects
Open Java Perspective
Expand org.eclipse.jdt.internal.corext
Edit Assert.java

Every time you open/close this file aprox 100k of java objects are leaked

I'll update this defect report as I find more information.
Comment 1 Kevin Haaland CLA 2003-03-05 18:04:16 EST
Added Nick as the leak may also be in the platform-ui code.

Small correction to the steps:
   binary projects for org.apache.*
   source projects for the rest
Comment 2 Dirk Baeumer CLA 2003-03-06 03:50:30 EST
*** Bug 33922 has been marked as a duplicate of this bug. ***
Comment 3 Dirk Baeumer CLA 2003-03-06 03:50:54 EST
Adam, can you try to reproduce this
Comment 4 Kevin Haaland CLA 2003-03-10 10:19:08 EST
Kai,Adam

 The Platform UI team has fixed a leak in IActionDelegate2. See this defect for 
details:

 http://bugs.eclipse.org/bugs/show_bug.cgi?id=34010
Comment 5 Adam Kiezun CLA 2003-03-11 05:56:52 EST
JavaModelOperation has a static reference to PerThreadObject
and stores there every reconcile thread that ever existed, even after its death
reconcile threads have references to CompilationUnitEditors and from there 
everything is leaked

maybe jcore should remove reconcile threads from the map as soon as they die
asking jcore for comment
Comment 6 Adam Kiezun CLA 2003-03-11 06:32:16 EST
this is a source of leaks in other places as well - it stores all 
ModelContextThreads too
Comment 7 Jerome Lanneluc CLA 2003-03-11 06:54:51 EST
Thanks for investigating Adam.

When poping the last operation (i.e. the top level operation), we should remove 
the reference to the current thread.

Proposed fix on JavaModelOperation:
	/*
	 * Removes the last pushed operation from the stack of running 
operations.
	 * Returns the poped operation or null if the stack was empty.
	 */
	protected JavaModelOperation popOperation() {
		ArrayList stack = getCurrentOperationStack();
		int size = stack.size();
		if (size > 0) {
			if (size == 1) { // top level operation -> free memory 
(see http://bugs.eclipse.org/bugs/show_bug.cgi?id=33927)
				operationStacks.setCurrent(null);
			}
			return (JavaModelOperation)stack.remove(size-1);
		} else {
			return null;
		}
	}
Comment 8 Philipe Mulet CLA 2003-03-11 16:54:33 EST
Approved change suggestion. 
Integrated for RC3.
Comment 9 David Audel CLA 2003-03-20 08:16:25 EST
Verified.