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.
Summary: | WebProject object memory leak in JsfProjectUtils | ||
---|---|---|---|
Product: | obsolete | Reporter: | Quy Nguyen <quynguyen> |
Component: | visualweb | Assignee: | _ potingwu <potingwu> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | Keywords: | PERFORMANCE |
Priority: | P1 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 104333 |
Description
Quy Nguyen
2007-05-18 22:53:51 UTC
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 |