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 125057

Summary: memory leak in org.netbeans.core.NbSheet
Product: platform Reporter: Quy Nguyen <quynguyen>
Component: ExplorerAssignee: Stanislav Aubrecht <saubrecht>
Status: RESOLVED FIXED    
Severity: blocker CC: skini
Priority: P2 Keywords: PERFORMANCE
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 123530    

Description Quy Nguyen 2008-01-10 19:45:50 UTC
The NbSheet.nodes field retains nodes that may no longer be in use, even when the properties window is closed.  This has
an effect on visual web projects that have been closed, since model objects are attached to the DesignBeanNode objects
held by NbSheet.

To reproduce:
1) Create a web project w/ the visualweb framework
2) Close the navigator window (suppresses another memory leak)
3) DnD some components to the page
4) Close Page1.jsp and close the project

After doing this, the properties window is closed, but the nodes are still held by NbSheet.  To clear them, the
properties window needs to be opened again.
Comment 1 Stanislav Aubrecht 2008-01-14 13:45:16 UTC
fixed

/cvs/core/src/org/netbeans/core/NbSheet.java,v  <--  NbSheet.java
new revision: 1.41; previous revision: 1.40
done
Checking in test/unit/src/org/netbeans/core/NbSheetTest.java;
/cvs/core/test/unit/src/org/netbeans/core/NbSheetTest.java,v  <--  NbSheetTest.java
new revision: 1.4; previous revision: 1.3
Comment 2 Shivanand Kini 2008-01-16 00:45:41 UTC
saubrecht,
PropertySheet.helperNodes also need to be cleared off, by calling propertySheet.setNodes(new Node[0] or null?) in
NbSheet.componentClosed()

Also see, http://www.netbeans.org/issues/show_bug.cgi?id=125322
Comment 3 Shivanand Kini 2008-01-16 01:45:56 UTC
The nodes also need to be cleared off from the SheetNodesListener. Though, I may not have waited for nodeDestroyed to be
called, during my profiling.

Just a thought, do you think it is better to call setNodes(new Node[0]) in componentClosed(), instead of 

nodes = null;
propertySheet.setNode...;
...


Comment 4 Stanislav Aubrecht 2008-01-17 12:17:52 UTC
fixed

Checking in core/src/org/netbeans/core/NbSheet.java;
/cvs/core/src/org/netbeans/core/NbSheet.java,v  <--  NbSheet.java
new revision: 1.43; previous revision: 1.42
done
Checking in core/test/unit/src/org/netbeans/core/NbSheetTest.java;
/cvs/core/test/unit/src/org/netbeans/core/NbSheetTest.java,v  <--  NbSheetTest.java
new revision: 1.5; previous revision: 1.4
done
Checking in openide/explorer/test/unit/src/org/openide/explorer/propertysheet/PropertySheetTest.java;
/cvs/openide/explorer/test/unit/src/org/openide/explorer/propertysheet/PropertySheetTest.java,v  <--  PropertySheetTest.java
new revision: 1.4; previous revision: 1.3
done
Checking in openide/explorer/src/org/openide/explorer/propertysheet/PropertySheet.java;
/cvs/openide/explorer/src/org/openide/explorer/propertysheet/PropertySheet.java,v  <--  PropertySheet.java
new revision: 1.23; previous revision: 1.22