JDK-4496253 : Memory leak Container.java removeNotify LigthweightDispatcher
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-08-24
  • Updated: 2002-09-20
  • Resolved: 2002-09-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2 mantisFixed
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
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis FIXED IN: mantis INTEGRATED IN: mantis
14-06-2004

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(); } } ======================================================================
11-06-2004

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
21-08-2002