libgcj/353: Memory Leak
Heinz@chanet.de
Heinz@chanet.de
Mon Oct 9 07:50:00 GMT 2000
>Number: 353
>Category: libgcj
>Synopsis: Memory Leak
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: tromey
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Oct 09 07:50:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Heinz Doerr
>Release: gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
Linux 2.2.16 with Suse 7.0, i386
>Description:
I'm trying to evaluate using java via gcj to write Linux background damons. So far so good, my biggest problem are memory leaks. Calling the Process.exec method results in heavily increasing program size. That's for native compiled programs (.java or .class as source does not matter). java interpreted bytecode is ok.
Here is my test program:
import java.lang.*;
import java.io.*;
class fwbg {
public static void main (String[] args) {
System.out.println("hello!\n");
Runtime me= Runtime.getRuntime();
char[] c= new char[100];
try {
for (int i= 0; i < 1000000; i++) {
Process p= me.exec("ipchains -L -n -v");
InputStreamReader istrm= new InputStreamReader(p.getInputStream());
int l;
int cnt= 0;
while ((l= istrm.read(c, 0, 100)) > 0) {
}
p.waitFor();
istrm.close();
p= null;
istrm= null;
System.gc();
}
} catch (Exception e) {
System.out.print ("Exception handler: ");
System.out.print (e.getMessage());
System.out.println ();
}
}
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Java-prs
mailing list