This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 49975 - Memory Leak when using JavaTargetChooserPanelGUI
Summary: Memory Leak when using JavaTargetChooserPanelGUI
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: All Windows ME/2000
: P2 blocker (vote)
Assignee: Petr Hrebejk
URL:
Keywords:
Depends on:
Blocks: 48877
  Show dependency tree
 
Reported: 2004-10-06 02:22 UTC by Chris Webster
Modified: 2004-10-11 15:49 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch for the memory leak (1.26 KB, patch)
2004-10-06 23:06 UTC, Chris Webster
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Webster 2004-10-06 02:22:33 UTC
I have been profiling some code and I noticed that
when indirectly using the
JavaTragetChooserPanelGUI (with the botton option
panel of JavaTemplates.createPackageChooser) I
have a memory leak. This issue is caused by the
static CELL_RENDERER declaration. As this class
inherits from JLabel the parent is set to the
containing class, thus when the wizard exits the
JavaTemplateChooser as well as the bottomPanel
which is what attracted my attention is still
strongly referenced. This reference is cleared
only when the next instance of this class is
created. If this renderer were not static this
would eliminate the issue.
Comment 1 Chris Webster 2004-10-06 23:06:45 UTC
Created attachment 18105 [details]
Patch for the memory leak
Comment 2 Petr Hrebejk 2004-10-07 17:58:15 UTC
I have nothing against the patch. And I will integrate it. But could
you be more specific. E.g. instances of which classes do stay in the
memory after finishing the dialog. I can't reproduce that in my profiler.


Thanks.
Comment 3 Chris Webster 2004-10-08 17:36:26 UTC
Here is what I can deduce from profiling:
* When the cell render is used, the parent property is set to point to
the TargetChooserGUI ... 
* The parent property is not reset (at least in JDK 1.4.2_05) and thus
this panel hangs around. This is my best guess at what is happening.

Comment 4 Petr Hrebejk 2004-10-11 11:09:34 UTC
Looking at the JavaTargetChooserPanelGUI the line you mention in your
patch is gone. Jesse rewrote it when he implemented the tree formed
view in the projects tab.
Currently the renderer is set with:
packageComboBox.setRenderer(PackageListView.listRenderer()
which does not create the reference. So this should be already fixed
in the main trunk (Probably also the reason why I can't see the memory
leak in the profiler)

         
Comment 5 Chris Webster 2004-10-11 15:37:44 UTC
The leak was detected when looking at the memory characteristics of
EA1 for J2EE support, which is based on the Beta2 branch. 

Comment 6 Petr Hrebejk 2004-10-11 15:49:24 UTC
Yes, Beta2 still contains the static field. The last trunk does not.
Please verify. Thanks.