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 98962

Summary: Recent files unnecessarily use FileObject as the path holder.
Product: utilities Reporter: Petr Nejedly <pnejedly>
Component: Open FileAssignee: David Simonek <dsimonek>
Status: RESOLVED FIXED    
Severity: blocker CC: issues
Priority: P2 Keywords: PERFORMANCE, T9Y
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Petr Nejedly 2007-03-26 13:28:45 UTC
This alone won't be that bad, not a real leak, and FileObject is quite small,
but many IDE caches or helper maps use FileObject keyed weak hash maps that are
not freed this way.
Moreover, it makes runtime diagnostics using "Run time watches" much harder as
the FileObject is used as the key as well.
I believe using just the path (URI) would work well for given purpose.
Comment 1 _ rkubacki 2007-05-23 16:35:32 UTC
Another example is editor document held through DiffSidebar

Java Static References
Static reference from org.netbeans.modules.openfile.RecentFiles.history (from
class org.netbeans.modules.openfile.RecentFiles) :
--> java.util.ArrayList@0x830a18a0 (20 bytes) (field elementData:)
--> [Ljava.lang.Object;@0x843f3008 (124 bytes) (Element 19 of
[Ljava.lang.Object;@0x843f3008:)
--> org.netbeans.modules.openfile.RecentFiles$HistoryItem@0x8668d598 (20 bytes)
(field file:)
--> org.netbeans.modules.masterfs.MasterFileObject@0x843ff620 (21 bytes) (field
listeners:)
--> javax.swing.event.EventListenerList@0x843fff48 (12 bytes) (field listenerList:)
--> [Ljava.lang.Object;@0x8702ccb8 (32 bytes) (Element 5 of
[Ljava.lang.Object;@0x8702ccb8:)
--> org.netbeans.modules.versioning.diff.DiffSidebar@0x86bc9a28 (385 bytes)
(field document:)
--> org.netbeans.modules.editor.NbEditorDocument@0x8668cce0 (192 bytes)
Comment 2 David Simonek 2007-06-05 14:57:43 UTC
started...not a small rewrite...
Comment 3 David Simonek 2007-06-06 12:56:23 UTC
fixed in main trunk:

Checking in src/org/netbeans/modules/openfile/RecentFiles.java;
/cvs/utilities/src/org/netbeans/modules/openfile/RecentFiles.java,v  <-- 
RecentFiles.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/netbeans/modules/openfile/RecentFileAction.java;
/cvs/utilities/src/org/netbeans/modules/openfile/RecentFileAction.java,v  <-- 
RecentFileAction.java
new revision: 1.6; previous revision: 1.5
done
Checking in test/unit/src/org/netbeans/modules/openfile/RecentFilesTest.java;
/cvs/utilities/test/unit/src/org/netbeans/modules/openfile/RecentFilesTest.java,v
 <--  RecentFilesTest.java
new revision: 1.3; previous revision: 1.2
done