[kaffe] Weird memory <leal|garbage> problem
Jean-Sebastien Bettez
bettez@8D.com
Thu, 5 Dec 2002 11:33:35 -0500
-----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 =3D new byte[0];
while(true) {
if(data.length =3D=3D 50 * 1024) {
data =3D new byte[0];
}
byte[] newdata =3D new byte[data.length+1];
data =3D newdata;
}
}
}
with this command:=20
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=20
the heap size from the default 64M to 6M. Without this=20
switch it will do the same thing but after a longer period=20
of time.
The problem seem to be that the class allocate differente=20
size of bytes arrays.
If I replace the line:
byte[] newdata =3D new byte[data.length+1];
by=20
byte[] newdata =3D new byte[data.length];
I have no problem.
Anyone have a clue?
thanks & seeya!
- --=20
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=3D
=3DnDVO
-----END PGP SIGNATURE-----