ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: Task to perform garbage collection
Date Tue, 18 Jun 2002 19:56:07 GMT
I've always heard this wasn't of much use... The Java language 3rd edition
as a snippet of code doing it in a loop, querying the memory available to
see if it increases, but warns it can have little to no effect, and can
actually impair some VMs.

JProbe's kind of the unique way to know for sure where's the memory going,
but it's far from free unfortunately. Using WeakReference instead of hard
references is a good start to avoid leaking too much memory.

We've used JProbe successfully on our projects (not me though), especially
related to Swing and the classical listener pattern.

As I've learned in my use of Ant, forking is the safest approach for most
heavyweight tasks, but Ant's own memory usage is another problem. --DD

-----Original Message-----
From: Magesh Umasankar [] 
Sent: Tuesday, June 18, 2002 2:37 PM
To: Ant Developers List
Subject: Task to perform garbage collection


I propose to create a very simple task named
<recyclememory/> or <collectgarbage/> that

* invokes System.runFinalization(); and then
* invokes System.gc();

This gives the build writer a chance to
suggest to the JVM to free up memory just
before start of a heavy-weight job, for 



*  When in doubt, mumble; when in trouble,  *
*  delegate; when in charge, ponder.        *
*                          - James H. Boren *

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message