You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2010/03/30 00:22:00 UTC

DO NOT REPLY [Bug 49021] New: TaskDef/ScriptDef in Sub Build = Memory Disaster

https://issues.apache.org/bugzilla/show_bug.cgi?id=49021

           Summary: TaskDef/ScriptDef in Sub Build = Memory Disaster
           Product: Ant
           Version: 1.8.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: mbm@ptc.com


Sub-builds (antcall, subant) load a task each time the task is defined, but do
not release it when the sub-build project completes.  

It would be best if the sub-build would recognize the task is already loaded,
just like it does when the task is loaded within the same project using
loaderref.  If it is not feasible to re-use the task in this scenario, then it
should be released to avoid sucking up all the available memory very quickly. I
think this is only a problem with recent (> 1.5.8) releases of Groovy, since it
requires so much PermGen.  You can't give it enough anymore.

The attached script runs out of memory in about 34 iterations of defining the
groovy task within an antcall. 

It can be run as follows, where 3rdparty_libdir is the folder that contains the
jars needed for the groovy task:
  ant -f GroovyMem.xml -Diterations=100 -D3rdparty_libdir=\3rdPartyJars\lib

Note: The script uses AntContrib to iterate.

http://marc.info/?l=ant-user&m=126970939205980&w=2

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49021] TaskDef/ScriptDef in Sub Build = Memory Disaster

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49021

--- Comment #2 from Keith D Gregory <kd...@yahoo.com> 2010-08-09 07:40:18 EDT ---
I ran into a similar problem. It appears that <taskdef> creates a new
classloader every time (makes sense), but uses the J2EE delegation model and
doesn't tie that classloader to the task/project that created it (doesn't make
sense to me, but there might be a reason). So the classes never get GC'd. A
longer writeup is on blog.kdgregory.com, today's date.

There is a work-around: use Groovy via antlib, just like you're already doing
with ant-contrib. Change your <project> element like this:

<project name="GroovyMem" default="all"
         xmlns:antc="antlib:net.sf.antcontrib"
         xmlns:groovy="antlib:org.codehaus.groovy">

Then delete all of the <taskdef>s, and refer to the Groovy tasks using the
namespace prefix:

   <target name="run_groovy">
            <groovy:groovy>
               // do nothing
            </groovy:groovy>               
   </target>

Note that you will have to add Groovy to Ant's runtime classpath. My preferred
way to do this is with the "-lib" command-line option.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49021] TaskDef/ScriptDef in Sub Build = Memory Disaster

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49021

Mike Murray <mb...@ptc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49021] TaskDef/ScriptDef in Sub Build = Memory Disaster

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49021

Antoine Levy-Lambert <an...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.8.1                       |1.8.2

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49021] TaskDef/ScriptDef in Sub Build = Memory Disaster

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49021

Mike Murray <mb...@ptc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mbm@ptc.com

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49021] TaskDef/ScriptDef in Sub Build = Memory Disaster

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49021

--- Comment #1 from Mike Murray <mb...@ptc.com> 2010-03-29 22:29:26 UTC ---
Created an attachment (id=25209)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25209)
Analysis Script

Demonstrates memory bug with:
   ant -f GroovyMem.xml -Diterations=100 -D3rdparty_libdir=\3rdPartyJars\lib

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49021] TaskDef/ScriptDef in Sub Build = Memory Disaster

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49021

Antoine Levy-Lambert <an...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.8.0                       |1.8.1

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49021] TaskDef/ScriptDef in Sub Build = Memory Disaster

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49021

Michael Rennie <mi...@ca.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michael_rennie@ca.ibm.com

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.