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

           Summary: Memory growth during copy with use of FilterReader
           Product: Ant
           Version: 1.7.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Core tasks
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


When a <Copy> is performed with the use of <FilterChain>/<FilterReader>, a
separate instance of the filter reader is created, under its own classloader,
for every file copied. Every one of these classloaders is registered with the
Project as a BuildListener, and not unregistered until the copy completes. This
leads to potentially huge memory growth during the copy.

I've addressed the situation in my own environment in my FilterReader, with the
following hack:

public int read() {
   ... perform filtering ...

   if (eof_detected) {
     
getProject().removeBuildListener((AntClassLoader)getClass().getClassLoader());
   }
}

It's a risky hack, but doesn't seem to have broken anything.

My project uses Ant 1.6.1, but I have verified the memory growth with 1.7.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.

Reply via email to