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 70601 - Memory leak in SJSAS DeploymentConfiguration
Summary: Memory leak in SJSAS DeploymentConfiguration
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 8 (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: _ pcw
URL:
Keywords: PERFORMANCE
Depends on:
Blocks: 60255
  Show dependency tree
 
Reported: 2005-12-19 22:06 UTC by _ pcw
Modified: 2005-12-22 23:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch to fix this bug. (3.68 KB, text/plain)
2005-12-19 22:51 UTC, _ pcw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ pcw 2005-12-19 22:06:31 UTC
This is a placeholder for the second leak described in detail in issue 60255. 
Specifically, in NB 5.0, there is a static map of existing
DeploymentConfiguration instances that is holding onto an instance after the
corresponding project is closed.  This is leaking 10-100k of memory per project
instance opened in an IDE session.
Comment 1 _ pcw 2005-12-19 22:10:46 UTC
The map in question is a WeakHashMap, but the key used currently is apparently
never freed and actually there probably isn't a key that can be used that fits
the contract for WeakHashMap.

The solution for the leak, recommended by Stepan, is have the map hold a
WeakReference to a DeploymentConfiguration instead of a strong reference.  Since
j2eeserver will have a strong reference to any valid DeploymentConfiguration,
there should not be a concern that the configuration would be prematurely
garbage collected.  I have implemented this and it works well.  I have kept the
WeakHashMap so that the WeakReference holder will also be garbage collected when
the keys are released (which they will be, now that the DeploymentConfiguration
can be.)
Comment 3 _ pcw 2005-12-19 22:51:48 UTC
Created attachment 27960 [details]
Patch to fix this bug.
Comment 4 Vince Kraemer 2005-12-20 00:10:41 UTC
this looks fine to me.
Comment 5 _ pcw 2005-12-22 23:02:31 UTC
Fix committed to release50 branch.