United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4496253 : Memory leak Container.java removeNotify LigthweightDispatcher

Details
Type:
Bug
Submit Date:
2001-08-24
Status:
Resolved
Updated Date:
2002-09-20
Project Name:
JDK
Resolved Date:
2002-09-20
Component:
client-libs
OS:
windows_2000
Sub-Component:
java.awt
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
1.4.2 (mantis)

Related Reports

Sub Tasks

Description

Name: boT120536			Date: 08/24/2001


java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

This appears to be the same issue as #4228292 only it must have moved into
Container.java proper.

This APPEARS to also be in Java 1.4beta as the Container.java source is
unchanged -- but I haven't begun testing under 1.4beta.

We're using a single JVM to launch multiple applications using Method.invoke on
main() for our individual applications.  We've gone to great lengths to insure
memory is collected, and cleaned up if an application closes.

Using OptimizeIt we've manage to clear every reference in our applications,
with the exception of one that is being held by Container.java -- a
LightweightDispatcher.  We modified Container.java to set dispatcher = null
after calling dispatcher.dispose() in removeNotify().  This allows us to have
no memory leaks.

We'd like to NOT have to patch Container.java ourselves.
(Review ID: 130645) 
======================================================================

                                    

Comments
EVALUATION

Commit to fix in Tiger (memory leak).  
###@###.### 2002-08-21

This such a quick fix that I'm putting it back into Mantis.
###@###.### 2002-09-10
                                     
2002-08-21
WORK AROUND



Name: boT120536			Date: 08/24/2001


Add specified line setting dispatcher=null; to Container.java and replace in
rt.jar -- ugly, but doable.

/**
* Makes this Container undisplayable by removing its connection
* to its native screen resource.  Make a container undisplayable
* will cause any of its children to be made undisplayable.
* This method is called by the toolkit internally and should
* not be called directly by programs.
* @see Component#isDisplayable
* @see #addNotify
*/
public void removeNotify()
{
	synchronized(getTreeLock())
	{
		int ncomponents = this.ncomponents;
		Component component[] = this.component;
		for (int i = 0 ; i < ncomponents ; i++)
		{
			component[i].removeNotify();
		}
		if (dispatcher != null)
		{
			dispatcher.dispose();
			dispatcher = null;	// *** FIX: ADD this line! ***
		}
		super.removeNotify();
	}
}
======================================================================
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis

FIXED IN:
mantis

INTEGRATED IN:
mantis


                                     
2004-06-14



Hardware and Software, Engineered to Work Together