ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45439] New: Memory growth during copy with use of FilterReader
Date Sun, 20 Jul 2008 12:27:10 GMT
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: notifications@ant.apache.org
        ReportedBy: nmeyers@javalinux.net


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.

Mime
View raw message