Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 124710 - Memory leak in Java Help
Memory leak in Java Help
Status: CLOSED FIXED
Product: projects
Classification: Unclassified
Component: Generic Projects UI
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Jaroslav Tulach
issues@projects
perfleak
: JDK_SPECIFIC, PERFORMANCE, TEST
: 124711 (view as bug list)
Depends on: 126952
Blocks: 121855
  Show dependency treegraph
 
Reported: 2008-01-04 14:59 UTC by Jaroslav Tulach
Modified: 2011-06-09 09:56 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2008-01-04 14:59:38 UTC
Run commit validation with one additional test enabled, as described in issue 121855, and you will get:


private static org.netbeans.modules.javahelp.JavaHelp org.netbeans.modules.javahelp.Installer.help->
org.netbeans.modules.javahelp.JavaHelp@183cff3-lastJH->
javax.help.JHelp@1f9c025-contentViewer->
javax.help.JHelpContentViewer@417ad4-ui->
javax.help.plaf.basic.BasicContentViewerUI@86a78b-vp->
javax.swing.JViewport@1cfd851-componentListener->
javax.swing.text.html.HTMLEditorKit$HTMLFactory$BodyBlockView@10eb439-attr->
javax.swing.text.html.StyleSheet$ViewAttributeSet@82f1a1-attrs->
[Ljavax.swing.text.AttributeSet;@fb7e63-[0]->
javax.swing.text.html.StyleSheet$ResolvedStyle@f041ba-attrs->
[Ljavax.swing.text.AttributeSet;@90f865-[1]->
javax.swing.text.html.StyleSheet$ResolvedStyle@5c159-attrs->
[Ljavax.swing.text.AttributeSet;@1dfad8c-[1]->
javax.swing.text.html.StyleSheet$ResolvedStyle@a64fd5-attrs->
[Ljavax.swing.text.AttributeSet;@f9ba76-[0]->
javax.swing.text.StyleContext$NamedStyle@1c0e8aa-this$0->
javax.swing.text.html.StyleSheet@430cca-css->
javax.swing.text.html.CSS@17fda21-styleSheet->
javax.swing.text.html.StyleSheet@1c4877b-styles->
javax.swing.text.StyleContext$NamedStyle@b9f6de-listenerList->
javax.swing.event.EventListenerList@957cae-listenerList->
[Ljava.lang.Object;@1f056cb-[1]->
javax.swing.text.DefaultStyledDocument$StyleContextChangeHandler@14b80d4-this$0->
javax.swing.text.html.HTMLDocument@25b43e-listenerList->
javax.swing.event.EventListenerList@551887-listenerList->
[Ljava.lang.Object;@1e65eed-[1]->
javax.swing.text.DefaultCaret$Handler@355fd4-this$0->
javax.swing.plaf.basic.BasicTextUI$BasicCaret@166825e-component->
javax.swing.JEditorPane@1e2b917-parent->
javax.swing.JViewport@f87be4-parent->
javax.swing.JScrollPane@f146ac-parent->
org.netbeans.modules.project.ui.TemplatesPanelGUI@1d7b2d1-parent->
org.netbeans.modules.project.ui.TemplateChooserPanelGUI@41d54b-project->
org.netbeans.modules.java.j2seproject.J2SEProject@1ad37f6
Comment 1 mslama 2008-01-07 12:33:31 UTC
Project should release UI component when closed. Javahelp keeps reference to last opened javahelp instance so that if
user reopens Help window it will be in the state when closed AND reopen is fast.
Comment 2 Milan Kubec 2008-01-14 13:47:12 UTC
And what if lastJH would be weak/soft reference?
Comment 3 mslama 2008-01-14 13:57:04 UTC
This does not work as reopening of Help window would sometimes show last opened help context (when lastJH is kept) and
sometimes default help context (when lastJH would be gc'ed). It would result in random behavior - very bad from user
point of view.

I assume project knows when it is closed so that it will not use any UI anymore - the best moment to release its
references to Swing components. Yes then Swing components will be still kept in memory because of Swing but it is Swing
problem. Project instance itself (org.netbeans.modules.java.j2seproject.J2SEProject@1ad37f6 from log) could be gc'ed.

IMO root problem is Swing impl when 2 independent Swing components are connected through internal references. It would
be good to write simple test case and file issue against Swing.
Comment 4 Milan Kubec 2008-01-16 10:44:42 UTC
*** Issue 124711 has been marked as a duplicate of this issue. ***
Comment 5 Milan Kubec 2008-02-06 13:26:33 UTC
Fixed.

http://hg.netbeans.org/main/rev/6ba7dab8f13a
Comment 6 Milan Kubec 2008-02-06 13:27:18 UTC
fixed
Comment 7 Jesse Glick 2008-02-07 00:33:10 UTC
Have to roll this back (d3a8f4b148ed). It results in TemplateChooserPanel.getProject() returning null, which wreaks all
kinds of havoc; for example, trying to run the Wizard wizard on a module project, after selecting the template if you
click Next you get NPEs and the wizard does not advance.
Comment 8 Milan Kubec 2008-02-07 08:19:47 UTC
I did couple of tests, but unfortunately not enough.
Comment 9 Milan Kubec 2008-02-19 11:59:15 UTC
This memory leak is in fact problem in swing and I found out that when running on JDK 1.6 this memory leak is not
detected, so it's probably fixed. I suppose we could close this issue. Jardo?
Comment 10 Jaroslav Tulach 2008-02-21 15:31:42 UTC
changeset:   68108:57515bb70892
tag:         tip
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Thu Feb 21 16:30:17 2008 +0100
summary:     #124710: When the panel is being hidden, cleanup its internal reference to project
Comment 11 Jaroslav Tulach 2008-02-22 13:42:35 UTC
changeset:   68111:d7dca03618b3
tag:         tip
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Fri Feb 22 14:41:36 2008 +0100
summary:     #124710: Removing the editor pane from the html panel description as it seems to cause memory leak
Comment 12 Marian Mirilovic 2011-06-09 09:56:50 UTC
v/c


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo