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 163150

Summary: NamingFactory uses WeakHashMap for cache instead of SoftReferences
Product: platform Reporter: tackline <tackline>
Component: FilesystemsAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: blocker CC: issues, mmirilovic
Priority: P3 Keywords: PERFORMANCE
Version: 6.x   
Hardware: PC   
OS: Windows Vista   
Issue Type: DEFECT Exception Reporter:

Description tackline 2009-04-20 18:45:20 UTC
netBeans demonstrates some catastrophic performance issues. In particular it often seems to be doing lots of file 
access with no disc activity. That would appear to be because it is rapidly doing lots of file operations on the same 
files. These accesses are supposed to be cached.

Looking into with jconsole, a likely culprit is org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory.nameMap. 
That uses a WeakHashMap with transient Integer keys for a cache. because the use WeakReference, entries of such a map 
can be removed immediately. Caches should use SoftReferences for keys. (Why there aren't any sensible caches in the 
Java library, ask Josh.)
Comment 1 Jaroslav Tulach 2011-05-30 19:17:37 UTC
I doubt your analysis is correct. Yes, there used to be nameMap, but rather than having problems with WeakReferences, it may just be too big.

Anyway nameMap and WeakHashMap were removed in 7.0 and replaced by home made hash table.