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 [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 18, 2002 2:37 PM To: Ant Developers List Subject: Task to perform garbage collection Hi, 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 instance. Comments? Cheers, Magesh ********************************************* * When in doubt, mumble; when in trouble, * * delegate; when in charge, ponder. * * - James H. Boren * ********************************************* -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
