Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 66299 invoked from network); 3 Mar 2004 22:02:14 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 3 Mar 2004 22:02:14 -0000 Received: (qmail 8704 invoked by uid 500); 3 Mar 2004 22:02:00 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 8651 invoked by uid 500); 3 Mar 2004 22:02:00 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 8635 invoked from network); 3 Mar 2004 22:01:59 -0000 Received: from unknown (HELO exchange.sun.com) (192.18.33.10) by daedalus.apache.org with SMTP; 3 Mar 2004 22:01:59 -0000 Received: (qmail 15976 invoked by uid 50); 3 Mar 2004 22:02:32 -0000 Date: 3 Mar 2004 22:02:32 -0000 Message-ID: <20040303220232.15975.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: dev@ant.apache.org Cc: Subject: DO NOT REPLY [Bug 27420] New: - cleanup() never called on ant class loader when running junit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . 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=27420 cleanup() never called on ant class loader when running junit Summary: cleanup() never called on ant class loader when running junit Product: Ant Version: 1.7Alpha (nightly) Platform: PC OS/Version: Windows XP Status: NEW Severity: Normal Priority: Other Component: Optional Tasks AssignedTo: dev@ant.apache.org ReportedBy: drabe@opentext.com When I run my unit tests with fork="false", the JVM heap size continually increases. I've duplicated this with a simple test case. In short, I believe there's a bug in the ant junit task because it doesn't clean up its classloaders. Here's the scenario: I have five identical testcases (each a subclass of an abstract test case). The abstract class declares a "static Integer memoryHog[] = new Integer[ 500000 ];". When each class is loaded, then, it should allocate a couple megabytes of memory. The test method itself sleeps for five seconds (to make it easier to watch what's going on), and then prints out totalMemory(). When I run this from ant, I get the following output: test: [junit] Running MyTest [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Running MyTest1 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Output: [junit] Max memory: 6828 [junit] Running MyTest2 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Output: [junit] Max memory: 8144 [junit] Running MyTest3 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Output: [junit] Max memory: 11640 [junit] Running MyTest4 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5.001 sec [junit] Output: [junit] Max memory: 15168 [junit] Running MyTest5 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Output: [junit] Max memory: 18636 The debug output confirms what I see in task manager -- heap size increasing by 2-3Mb for each testcase. Next, I changed JUnitTask to call cleanup() on the class loader after running the tests. This is the diff (against CVS HEAD): RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/ JUnitTask.java,v retrieving revision 1.93 diff -r1.93 JUnitTask.java 974a975 > classLoader.cleanup(); Now when I run the tests, I don't see the increasing memory problem: test: [junit] Running MyTest [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Running MyTest1 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Output: [junit] Max memory: 6828 [junit] Running MyTest2 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Output: [junit] Max memory: 6828 [junit] Running MyTest3 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Output: [junit] Max memory: 6828 [junit] Running MyTest4 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Output: [junit] Max memory: 6828 [junit] Running MyTest5 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 5 sec [junit] Output: [junit] Max memory: 6828 However, I don't profess to know enough about classloaders OR ant OR junit to know if this is the right fix. In fact, the ant unit tests fail with my mod, so it's probably not right. (DefaultExcludesTest:test1 fails.) Regards, Daniel Rabe Sr. Software Architect Open Text, Inc. Boulder, Colorado http://www.opentext.com --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org