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.
The JsfProjectUtils.JavaEE5Project field causes a memory leak of WebProject objects. This static map never removes entries, so the project objects will stay in memory. This has been assigned as a P1 since it may potentially block the detection of other memory leaks.
Why the other JsfProjectUtils.propertyListeners field does not have the same issue? This code was somehow copied from NetBeans long ago. NetBeans has many of this kind of cache implementation as I seen. Please advise the alternative.
I checked again and the JsfProjectUtils.propertyListeners field also has the same problem, but it was more difficult to find since the NB profiler heap walker only finds a single GC root. One possible way to solve this would be to change both fields to WeakHashMap to avoid the memory leak. Assuming the WebProject object lifecycle is managed elsewhere, this solution should work correctly.
There are few ways to not holding closed project; by using project root DataFolder or root-path String as the Key instead of Project itself. However, I just fixed it by replacing HashMap by WeakHashMap as you suggested. I searched NetBeans web area that they also have many of this kind of cache. But I only found usage of WeakHashMap in 'our' web/jsf/navigation! I'm hoping NetBeans itself won't have this memory leak issue and hoping this 'Weak' stuffs won't introduce any new regression.
v. 20070624180000