[kaffe] memory leaking

Greg Wooledge greg at wooledge.org
Wed Jun 11 07:06:02 PDT 2003

Martin Pohlack (mp26 at os.inf.tu-dresden.de) wrote:

> In my recent attempt to build kaffe with the "diet libc" I noticed some 
> #warnings, given by "diet libc":
> ../kaffevm/.libs/libkaffevm.a(syscalls.o)(.text+0x4e8): In function 
> `jthreadedGetHostByAddr':
> /home/mp26/erwin/kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:270: 
> warning: gethostbyaddr() leaks memory.  Use gethostbyaddr_r instead!
> ../kaffevm/.libs/libkaffevm.a(syscalls.o)(.text+0x493): In function 
> `jthreadedGetHostByName':
> /home/mp26/erwin/kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:251: 
> 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

OpenBSD doesn't have the *_r versions.

Greg Wooledge                  |   "Truth belongs to everybody."
greg at wooledge.org              |    - The Red Hot Chili Peppers
http://wooledge.org/~greg/     |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20030611/6a788373/attachment-0002.pgp 

More information about the kaffe mailing list