ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 25108] New: - Suspected memory leak when using filters to copy a large number of files
Date Mon, 01 Dec 2003 14:07:08 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25108

Suspected memory leak when using filters to copy a large number of files

           Summary: Suspected memory leak when using filters to copy a large
                    number of files
           Product: Ant
           Version: 1.5.4
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: Marc.Philips@eurocontrol.int


In order to highlight the problem, I wrote a simple filter that prints the 
total amount of memory used by the JVM. As this filter is used to copy a large 
number of files, ant output shows that the memory usage increases periodically.


Filter:
-------

package eurocontrol.cfmu.tools.ant.filters;

import java.io.IOException;
import java.io.Reader;

import org.apache.tools.ant.filters.BaseParamFilterReader;

public class MyFilterReader extends BaseParamFilterReader {
	public MyFilterReader() {
		super();
	}

	public MyFilterReader(Reader in) {
		super(in);
	}

	public void close() throws IOException {
		super.close();
		in.close();
		System.out.println(Runtime.getRuntime().totalMemory());
	}
}


Build file:
-----------

<fileset dir = "${srcdir}" id = "copy-set">
	<!-- on my system, any fileset with 5000+ files will cause ant
	  -- to report an exception in thread main -->
</fileset>

<target name = "with-filter">
  <copy todir = "${destdir}">
    <fileset refid = "copy-set"/>
    <filterchain>
      <filterreader classname =
        "eurocontrol.cfmu.tools.ant.filters.MyFilterReader">
        <classpath>
          <pathelement location = "${libdir}"/>
        </classpath>
      </filterreader>
    </filterchain>

  </copy>
</target>

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


Mime
View raw message