[kaffe] Weird memory <leal|garbage> problem

Jean-Sebastien Bettez bettez at 8D.com
Thu Dec 5 08:33:35 PST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

We use kaffe 1.0.7 stock on linux (2.4.18).

If i run this class:
public class MemBug {

    public static void main(String[] argv) {
      byte[] data = new byte[0];
          while(true) {
                if(data.length == 50 * 1024) {
                    data = new byte[0];
                }
                byte[] newdata = new byte[data.length+1];
                data = newdata;
            }
    }

}
with this command: 
  kaffe -mx 6M MemBug

I do receive this message:

   java.lang.OutOfMemoryError
          at MemBug.main(MemBug.java:12)

after a couple of minute. The switch mx is only to reduce 
the heap size from the default 64M  to 6M. Without this 
switch it will do the same thing but after a longer period 
of time.

The problem seem to be that the class allocate differente 
size of bytes arrays.

If I replace the line:
  byte[] newdata = new byte[data.length+1];
by 
  byte[] newdata = new byte[data.length];

I have no problem.

Anyone have a clue?


thanks & seeya!
- -- 
Jean-Sebastien Bettez
8D Technologies inc.
http://www.8D.com
gpg key @ http://www.keyserver.net
"Life is a beach"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE973/gYVZC+f3PtyQRAnCjAJ9PuL3GVGaAm8YbV9YFJtn6jdvlJwCfRhdM
+0alpJbTULHsEm3E+oI/zm8=
=nDVO
-----END PGP SIGNATURE-----




More information about the kaffe mailing list