This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: gethostbyname_r leaks memory
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Wolfram Gloger <wmglo at dent dot med dot uni-muenchen dot de>
- Cc: krueger at kiwilogic dot com, bug-glibc at gnu dot org, libc-alpha at sources dot redhat dot com
- Date: Fri, 21 Mar 2003 11:53:12 -0500
- Subject: Re: gethostbyname_r leaks memory
- References: <EA744089E3DA0542A2877702FD97932C7066A6@klmail.kiwilogic.com> <20030321154120.10636.qmail@md.dent.med.uni-muenchen.de>
On Fri, Mar 21, 2003 at 03:41:20PM -0000, Wolfram Gloger wrote:
> Hi,
>
> I can easily reproduce this problem.
>
> I have some evidence that the leak is caused by the following:
>
> if (EXT(statp).nsaddrs[n] == NULL)
> EXT(statp).nsaddrs[n] =
> malloc(sizeof (struct sockaddr_in6));
>
> from resolv/res_send.c near line 440, which is apparantly producing
> lots of small chunks which in the multi-thread case are never freed.
> Perhaps someone who understands the resolver logic better can fix it
> straight away? I might take a look too but it's probably going to
> take some time..
Are you trying with a current glibc? Roland McGrath fixed this just
before the release of glibc 2.3.2.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer