The code in AntBuilder which manipulates the standard input and output stream is not thread safe: https://github.com/groovy/groovy-core/blob/GROOVY_2_0_7/subprojects/groovy-ant/src/main/java/groovy/util/AntBuilder.java#L207
If 2 or more threads are using AntBuilder at the same time then you end up with System.out or System.err holding a reference to a DemuxOutputStream.
Unfortunately this class (DemuxOutputStream) ends up (via a long chain of objects) to hold references to AntTypeDefinitions classes which are then never garbage collected.
After I ran my code for a long time, I used JProfiler and generated the attached screenshot. I had over 180,000 instances of AntTypeDefinitions (and growing...)
I just checked the trunk on github for groovy-core and can see it is the same code since 2.0.7. So I am assuming it is the same issue.