This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
GC Problems... (2nd file)
- From: Simon Levitt <simon dot levitt at worldpay dot com>
- To: java at gcc dot gnu dot org
- Date: Mon, 6 Sep 2004 17:59:41 +0100
- Subject: GC Problems... (2nd file)
- Organization: WorldPay
Sorry, twitchy finger syndrome....
Here's the 2nd file...
Simon.,
--
--------------------------------------------------------------------------
Simon Levitt, Principal Development Engineer @ WorldPay,
WorldPay Centre, The Science Park, Milton Rd., Cambridge, CB4 0WE, ENGLAND
Simon.Levitt@worldpay.com Ph:+44(0)1223 715151 F:+44(0)1223 715157
------------------------- http://www.worldpay.com/ -----------------------
import java.io.PrintStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Vector;
public class Helper
{
private static FileOutputStream debugOut = null;
protected Helper()
{
}
public static class GCThread extends Thread
{
public void run() {
try {
Runtime runtime = null;
runtime = Runtime.getRuntime();
while (true) {
// System.err.println("Running GC: " + (runtime.totalMemory() - runtime.freeMemory()) + "/" + runtime.totalMemory());
System.gc();
// System.err.println("GC Ran : " + (runtime.totalMemory() - runtime.freeMemory()) + "/" + runtime.totalMemory());
//System.err.println("");
Thread.sleep(100);
}
}
catch (Exception _) {}
}
}
private static GCThread check = null;
public static void doInit(String debugFile)
{
if (debugFile != null) {
try {
debugOut = new FileOutputStream(debugFile);
System.setErr(new PrintStream(debugOut));
}
catch (IOException _) {}
System.err.println("System.errFile: " + debugFile);
check = new GCThread();
check.start();
}
}
}
// End of Helper.java