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 36393 - Memory leak in Ant (ProcessDestroyer) -> NB holds onto old class loaders
Summary: Memory leak in Ant (ProcessDestroyer) -> NB holds onto old class loaders
Status: VERIFIED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 3.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: Jesse Glick
URL: http://nagoya.apache.org/bugzilla/sho...
Keywords: PERFORMANCE
Depends on: 36395
Blocks:
  Show dependency tree
 
Reported: 2003-10-01 23:53 UTC by Jesse Glick
Modified: 2005-07-14 16:17 UTC (History)
0 users

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 Jesse Glick 2003-10-01 23:53:49 UTC
This memory leak is fixed in Ant 1.6 beta 1.
However NetBeans using an older integration, e.g.
1.5.3, will still suffer from it, esp. in the
trunk (since NB can load Ant multiple times under
low memory conditions). This can cause
OutOfMemoryError's in the worst case.

Might be possible to work around by the following
hack:

After running a project, use introspection to load
java.lang.Shutdown. Get its static field 'hooks'
and cast to Set. Iterate through them. Cast each
to Shutdown.WrappedHook, and get the field 'hook'
from it. If the impl class of the value is named
org.apache.tools.ant.taskdefs.ProcessDestroyer
(the name under Ant 1.5.3 but not 1.6 where the
bug is fixed), cast the object to Thread, and call
Runtime.default.removeShutdownHook(thing).
Comment 1 Jesse Glick 2003-10-02 00:29:37 UTC
Have patch that appears to be working.
Comment 2 Jesse Glick 2003-10-02 21:19:36 UTC
Fixed as part of issue #36396.
Comment 3 Jesse Glick 2003-10-04 22:34:03 UTC
Will enhance workaround to also start the hook when it removes it,
solving the ThreadGroup memory leak described in issue #36395. (Ant
1.6 also has the same workaround, so when 1.6 is integrated this will
be solved as well.)
Comment 4 Jesse Glick 2003-10-07 21:34:20 UTC
Workaround for issue #36395 added:

committed   * Up-To-Date  1.5        
ant/src-bridge/org/apache/tools/ant/module/bridge/impl/BridgeImpl.java
Comment 5 Marek Grummich 2004-02-23 15:56:29 UTC
Jesse, as a reporter could you verify this bug to close its life
cycle? Thanks!
Comment 6 Jesse Glick 2004-02-23 17:10:27 UTC
Well I would have to actually verify that the fix is still working in
current trunk code, which is time-consuming... no time for it right
now. Should probably be covered by a unit test I suppose.
Comment 7 Jaromir Uhrik 2005-07-14 16:17:57 UTC
Verified.