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 - NamingFactory uses WeakHashMap for cache instead of SoftReferences
Summary: NamingFactory uses WeakHashMap for cache instead of SoftReferences
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 6.x
Hardware: PC Windows Vista
: P3 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2009-04-20 18:45 UTC by tackline
Modified: 2011-05-30 19:17 UTC (History)
2 users (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 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.