utf8const memory leak?

e. lambrecht eml at enws786.eas.asu.edu
Thu Mar 5 12:47:24 PST 1998


I've got the same problem with kaffe apparently not freeing up
strings. If you compile the following code, then run with -verbosemem,
the interpreter never seems to free up any utf8const's.

public class Memory {

  public static void main(String[] args) {

    int foo = 0;
    String bar;

    while (true) {
      bar = Integer.toString(foo);

      if ((foo++ % 500) == 0) {
	System.out.println("round " + bar);
      }

      bar = null;
    }
  }
}

I'm running this in kaffe JIT 0.92, Linux 2.0.31, with the old libc5
libraries. Does the same thing happen to people on other platforms?

Looking at the code... the function passed to gc_malloc when creating
a string is gcUtf8Const, which appears to have two definitions in
gc-incremental.c (one with GC_OBJECT_NORMAL (commented out), and one
with GC_OBJECT_FIXED). I guess this means that an express gc_free must
be used to free up the memory, and that strings aren't normally freed
up. If I adjust this to use GC_OBJECT_NORMAL, what kind of havoc will
that create? Does anybody know why it was commented out?

Eric..



More information about the kaffe mailing list