JDK-4136116 : Solaris and Solaris x86: SEVERE memory leak when using PopupMenus
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 1998-05-07
  • Updated: 1999-01-15
  • Resolved: 1999-01-15
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.2.0 1.2fcsFixed
Related Reports
Relates :  
Relates :  
Description
The interim fix for BugId 4062024 has introduced a major memory leak involving
PopupMenus. Any Frame, Window, or Dialog which contains one or more PopupMenus
will never be garbage collected because of a JNI global ref which is never
cleaned up. Since the top-level container has references to all of its children,
none of the children will ever be garbage collected either. This is potentially
every Component in the application. We cannot ship the FCS product in this
state.

Note that we also cannot correct this problem unless we correct the underlying
problem with 4062024. The work which Mike Bronson has been doing for CBOT
should do this.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic FIXED IN: 1.2fcs INTEGRATED IN: 1.2fcs
14-06-2004

SUGGESTED FIX The fix is trivial. We need to uncomment the awtJNI_DeleteGlobalRef line in Java_sun_awt_motif_MPopupMenuPeer_pDispose: From sun.awt.awt_PopupMenu.c: JNIEXPORT void JNICALL Java_sun_awt_motif_MPopupMenuPeer_pDispose (JNIEnv *env, jobject this) { struct MenuData *mdata; AWT_LOCK(); mdata = (struct MenuData *) JNU_GetLongField(env, this, "pData"); if (mdata == 0) { AWT_UNLOCK(); return; } XtDestroyWidget(mdata->comp.widget); free((void *) mdata); JNU_SetLongField(env, this, "pData", 0); /* UNCOMMENT THIS LINE TO FIX PROBLEM */ /* awtJNI_DeleteGlobalRef(env, this); */ AWT_UNLOCK(); }
11-06-2004

PUBLIC COMMENTS Any Frame, Window, or Dialog which has at least one PopupMenu will never be garbage collected, nor will any of its children. This is potentially every Component in the application.
10-06-2004

EVALUATION The changes made by Mike Bronson and the additional work done for 4083400 has corrected the underlying problem. I uncommented the line which deletes the JNI global ref. david.mendenhall@eng 1998-06-23
23-06-1998