[kaffe] memory leaking
Greg Wooledge
greg@wooledge.org
Wed Jun 11 07:06:02 2003
--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Martin Pohlack (mp26@os.inf.tu-dresden.de) wrote:
> In my recent attempt to build kaffe with the "diet libc" I noticed some=
=20
> #warnings, given by "diet libc":
>=20
> ../kaffevm/.libs/libkaffevm.a(syscalls.o)(.text+0x4e8): In function=20
> `jthreadedGetHostByAddr':
> /home/mp26/erwin/kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:270=
:=20
> warning: gethostbyaddr() leaks memory. Use gethostbyaddr_r instead!
> ../kaffevm/.libs/libkaffevm.a(syscalls.o)(.text+0x493): In function=20
> `jthreadedGetHostByName':
> /home/mp26/erwin/kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:251=
:=20
> warning: gethostbyname() leaks memory. Use gethostbyname_r instead!
Maybe diet libc's implementation does. In OpenBSD and most other Unix
systems, gethostbyname() uses a static buffer which is returned (or a
pointer to which is returned) every time. This means it's not safe to
use in multi-threaded apps. Kaffe's aware of this, as you can see by
the comments, so they lock the whole thing while it's doing a name
lookup.
OpenBSD doesn't have the *_r versions.
--=20
Greg Wooledge | "Truth belongs to everybody."
greg@wooledge.org | - The Red Hot Chili Peppers
http://wooledge.org/~greg/ |
--NzB8fVQJ5HfG6fxh
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (OpenBSD)
iD8DBQE+5zfEkAkqAYpL9t8RAhYOAJ9NKdfzLVxTBMtfA1YA5QfSNKQ8JACcDMAy
EM7U3eiWqv6a34BOJNc4y3g=
=go6f
-----END PGP SIGNATURE-----
--NzB8fVQJ5HfG6fxh--