-
Bug
-
Resolution: Fixed
-
P3
-
7u4
-
b13
-
x86
-
windows_xp
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2221043 | 8 | Pavel Porvatov | P3 | Resolved | Fixed | b27 |
J2SE Version (please include all output from java -version flag):
JDK 6 and 7
Does this problem occur on J2SE 1.5 or 6ux? Yes / No (pick one)
N/A
Bug Description:
had experiencing memory problems with our swing base client app.
Digging into the problem and found the root cause in
"javax.swing.plaf.synth.SynthTreeUI".
Checked the preview releases of jdk6 and 7 which both still
contain the issue. Hope to adress this problem so that a fix
would be encorporated in one of the next official release?
If it helps here is a short explaination of the problem and a possible fix:
1) Class "javax.swing.plaf.synth.SynthTreeUI" has a field named
"paintContext" of type "javax.swing.plaf.synth.SynthContext"
2) The field is set in the first line of method
"protected void paint(SynthContext context, Graphics g)"
3) The field is never cleared
4) According to our memory analyzer tool the instance keeps
references to dialog instances, event if this dialog instances
have been disposed and are otherwise not reachable
5) According "javax.swing.plaf.synth.SynthContext" instances
should not be cached (from java doc: "A SynthContext should
only be considered valid for the duration of the method it is
passed to. In other words you should not cache a SynthContext
that is passed to you and expect it to remain valid.")
Fix: Null the reference at the end of the
"paint(SynthContext context, Graphics g)"
(there is alread a comment about "gc"):
// Empty out the renderer pane, allowing renderers to be gc'ed.
rendererPane.removeAll();
paintContext = null; // <---------------- add this line
JDK 6 and 7
Does this problem occur on J2SE 1.5 or 6ux? Yes / No (pick one)
N/A
Bug Description:
had experiencing memory problems with our swing base client app.
Digging into the problem and found the root cause in
"javax.swing.plaf.synth.SynthTreeUI".
Checked the preview releases of jdk6 and 7 which both still
contain the issue. Hope to adress this problem so that a fix
would be encorporated in one of the next official release?
If it helps here is a short explaination of the problem and a possible fix:
1) Class "javax.swing.plaf.synth.SynthTreeUI" has a field named
"paintContext" of type "javax.swing.plaf.synth.SynthContext"
2) The field is set in the first line of method
"protected void paint(SynthContext context, Graphics g)"
3) The field is never cleared
4) According to our memory analyzer tool the instance keeps
references to dialog instances, event if this dialog instances
have been disposed and are otherwise not reachable
5) According "javax.swing.plaf.synth.SynthContext" instances
should not be cached (from java doc: "A SynthContext should
only be considered valid for the duration of the method it is
passed to. In other words you should not cache a SynthContext
that is passed to you and expect it to remain valid.")
Fix: Null the reference at the end of the
"paint(SynthContext context, Graphics g)"
(there is alread a comment about "gc"):
// Empty out the renderer pane, allowing renderers to be gc'ed.
rendererPane.removeAll();
paintContext = null; // <---------------- add this line
- backported by
-
JDK-2221043 Memory leak in javax.swing.plaf.synth.SynthTreeUI
-
- Resolved
-