gcj: mem leaks & speed.

Rutger Ovidius ovid@mailandnews.com
Sun Feb 1 01:07:00 GMT 2004


Hi,
I have an app that runs well under java, but when compiled with gcj it
seems to leak memory (a gig in a few hours) -- this has been reported
by users of the app on linux and windows.
Are there any tools or methods I can use that would help me track down
the cause? I'm finding it difficult since the mem leak isn't in my java
code as far as I can tell and java profiling isn't helping me.
(The app is an SWT gui app)
--
Also, while trying to track down memory use, I wrote the following
class:
public class Leak {
 public static void main(String[] argv) {
 long start = System.currentTimeMillis();
 for (int i = 0;; i++) {
 Leak l = new Leak(); 
 if (i % 100000000 == 0) {
 long curr = System.currentTimeMillis();
 System.out.println(i / 100000000 + ": " + (curr - start));
 }
 }
 }
}
This runs 10x as slow in gcj as it does in java on windows (~6x on
linux) If you remove the "Leak l = new Leak();" line, the speed
becomes rather similar to java. Why is class creation so slow? (or is
it GC cleanup that is slow?)
I then extended it to spawn threads to see if it gobbled up memory
(which it seems to..)
public class Leak implements Runnable {
 public static void main(String[] argv) {
 long start = System.currentTimeMillis();
 for (int i = 0;; i++) {
 Leak l = new Leak();
 new Thread(l).start();
 if (i % 10000 == 0) { // decrease
 long curr = System.currentTimeMillis();
 System.out.println(i / 10000 + ": " + (curr - start));
 }
 }
 }
 public void run() {
 int i = 9;
 }
}
This runs ~2x faster in gcj than in java for some reason (~5x faster
on linux). But, at the 16th line of output on windows:
libgcj failure: CreateEvent() failed
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I use: gcc version 3.4.0 20040130 (prerelease)
Regards,
Rutger Ovidius


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /