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 86809 - Diff sidebars cannot be GCed
Summary: Diff sidebars cannot be GCed
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Diff (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Maros Sandor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-09 22:08 UTC by _ rkubacki
Modified: 2006-10-23 16:39 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ rkubacki 2006-10-09 22:08:16 UTC
WeakHashMap in DiffSidebarManager is not working as the keys (instancesof
org.openide.text.QuietEditorPane) are strongly held by associated values
(org.netbeans.modules.versioning.diff.DiffSidebar). This obviously causes huge
memory leaks - editor cannot be closed and they hold a lot of other objects.
Comment 1 _ rkubacki 2006-10-09 22:09:35 UTC
Path holding the key - 

Static reference from
org.netbeans.modules.versioning.diff.DiffSidebarManager.instance (from class
org.netbeans.modules.versioning.diff.DiffSidebarManager) :
--> org.netbeans.modules.versioning.diff.DiffSidebarManager@0x8741c280 (13
bytes) (field sideBars:)
--> java.util.WeakHashMap@0x874208f8 (44 bytes) (field table:)
--> [Ljava.util.WeakHashMap$Entry;@0x87424068 (72 bytes) (Element 15 of
[Ljava.util.WeakHashMap$Entry;@0x87424068:)
--> java.util.WeakHashMap$Entry@0x88ac2eb8 (36 bytes) (field next:)
--> java.util.WeakHashMap$Entry@0x886f4aa8 (36 bytes) (field value:)
--> org.netbeans.modules.versioning.diff.DiffSidebar@0x886f6f38 (377 bytes)
(field textComponent:)
--> org.openide.text.QuietEditorPane@0x886f3950 (451 bytes)
Comment 2 Maros Sandor 2006-10-10 16:19:52 UTC
I tried to only weakly reference the sidebar but the problem persists ... is the
following reference OK or should I or someone else investigate further?

After closing editor TopComponent, Diff Sidebar not collected: 

static java.util.Map org.netbeans.editor.BaseKit.kitActions-> 
java.util.HashMap@5c9404-> 
[Ljava.util.HashMap$Entry;@5556af-> 
java.util.HashMap$Entry@1fd4b0b-> 
[Ljavax.swing.Action;@1d552d4-> 
org.netbeans.editor.ActionFactory$FindSelectionAction@19aef85-> 
javax.swing.event.SwingPropertyChangeSupport@18f8a24-> 
sun.awt.EventListenerAggregate@1f71df7-> 
[Ljava.beans.PropertyChangeListener;@12f2d00-> 
javax.swing.AbstractButton$ButtonActionPropertyChangeListener@134852d-> 
org.netbeans.modules.editor.NbEditorToolBar$WrapperAction@95940c-> 
org.netbeans.modules.editor.NbEditorToolBar@12e76db-> 
[Ljava.awt.Component;@152886a-> 
org.openide.awt.Actions$ToolbarButton@13cb1cb-> 
javax.swing.event.EventListenerList@124b1bb-> 
[Ljava.lang.Object;@ce725-> 
org.openide.util.actions.NodeAction$DelegateAction@1a47d8b-> 
org.openide.util.lookup.ProxyLookup$R@18b8ec7-> 
org.openide.windows.DefaultTopComponentLookup@325c32-> 
org.openide.text.CloneableEditor@18d604f-> 
org.openide.text.QuietEditorPane@11c3366-> 
javax.swing.JViewport@7025de-> 
javax.swing.JScrollPane@19d3901-> 
javax.swing.JViewport@1fb9eb3-> 
[Ljava.awt.Component;@18ca05c-> 
org.netbeans.modules.editor.CustomizableSideBar@72aebc-> 
[Ljava.awt.Component;@1500c94-> 
org.netbeans.modules.versioning.diff.DiffSidebar@550344
Comment 3 _ rkubacki 2006-10-11 09:35:34 UTC
Probably this is worth of another issue. I guess there will be only one
component held this way (or one per MIME type?). One place where we can cut this
chain IMO is between action and tooblar by removing listener if toolbar gets closed.
Comment 4 Maros Sandor 2006-10-16 13:26:10 UTC
Fixed by removing strong references from DiffManager to DiffSidebar.
Radim: please also check the reference I mentioned.

/shared/data/ccvs/repository/versioncontrol/src/org/netbeans/modules/versioning/diff/DiffSidebarManager.java,v
 <--  DiffSidebarManager.java
new revision: 1.2; previous revision: 1.1