-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.0.1, 1.3.0
-
generic, sparc
-
generic, solaris_2.6
Name: krC82822 Date: 11/22/2000
orig synopsis: "Last shown JPopupMenu cannot be garbage collected"
22 Nov 2000, eval1127@eng -- per inc#112117 (whose
synopsis has been transcribed to this report):
confirmed in 1.3.x sources, but the problem has
been eliminated as of the current merlin sources. PopupFactory replaces
DefaultPopupFactory, and it uses only local vars to refer to the invoker/owner.
No class-wide refs to the invoker/owner are retained.
Am filing a bug against 1.3, since this fix probably should be made
available earlier than merlin.
--------------------------
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
When a JPopupMenu is shown, the JPopupMenu.popupFactory instance keeps a
reference on it (private field DefaultPopupFactory.component).
Unfortunately, this reference will only be cleared the next time a Popup is
shown (see the DefaultPopupFactory.getPopup() method)
Therefore, the last JPopupMenu that was shown (and all the objects that are
linked to it) cannot be garbage collected.
In our case, this problem is really critical because we really need to detach a
large amount of data that is referenced by the menu items of our popup menu.
A simple fix could be to replace the private field 'component' of the class
DefaultPopupFactory by an additionnal argument in the private method
replacePopup(int).
May be the 'invoker' field could also be replaced by an additionnal arguments
on some methods. The 'frame' field doesn't seem to be used.
In the version I have this problem should also affect the ToolTipManager and
the JMenu.
-------------
from inc#112117:
----------
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)
When
JPopupMenu.show(Component invoker, int x, int y)
is invoked, indirectly causing
DefaultPopupFactory.getPopup(Component comp, Component invoker, int x, int y)
to be invoked, DefaultPopupFactory retains a reference to "invoker" (and also
"comp"). This prevents "invoker" from being garbage collected until another
popup menu is displayed. This also affects tooltips.
(Review ID: 107997)
======================================================================
- duplicates
-
JDK-4352535 ToolTipManager still leaks in Metal L&F
- Resolved