ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: subant and memory problems
Date Thu, 01 Jun 2006 06:41:59 GMT
>Probably not. Ideally there would be a fork attribute for <ant> (and
><subant>) to ensure each sub-build runs in its own VM, 
>ensuring proper release of memory (when the process exists), 
>but it's never been done and is non-trivial, since a 
>cross-process logger/listener thing needs to be put in place, 
>and what to do with references? Serialize them to the 
>sub-project? Not much is serializable in Ant.
>
>To solve your problem, you may have to switch to <apply>, 
>which forks a new Ant JVM for each sub-build (in non-parallel 
>mode), which would emulate fork=true for <ant>. --DD


Long time ago I wrote a macro for starting Ant from a buildfile

    <macrodef name="startAnt">
        <attribute name="args" default=""/>
        <sequential>
            <java classname="org.apache.tools.ant.launch.Launcher"
taskname="startAnt" errorproperty="nul">
                <arg line="@{args}"/>
                <permissions>
                    <!-- All what it need, without quitting the JVM -->
                    <revoke class="java.lang.RuntimePermission"
name="exitVM"/>
                    <grant  class="java.lang.RuntimePermission"
name="*"/>
                    <grant  class="java.lang.reflect.ReflectPermission"
name="*"/>
                    <grant  class="java.util.PropertyPermission"
name="*" actions="read,write"/>
                    <grant  class="java.io.FilePermission"
name="&lt;&lt;ALL FILES&gt;&gt;" actions="read,write,delete,execute"/>
                </permissions>
            </java>
        </sequential>
    </macrodef>


You could start with that implementing your <apply> (dont forget to
allow JVM-quittig) ;-)


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message