On Sat, Oct 02, 1999 at 11:37:22AM +0100, Steve Dodd wrote:
> [I assume that seeing you set Mail-Followup-To, you don't want a cc of this]
Dunno. I'm too lame to configure mutt :)
> gethostbyname() and friends return a pointer to a static structure. And my
> glibc info does have it, it's buried down in Sockets -> Internet Namespace
> -> Host Addresses -> Host Names:
>
> "You can use `gethostbyname' or `gethostbyaddr' to search the hosts
> database for information about a particular host. The information is
> returned in a statically-allocated structure; you must copy the
> information if you need to save it across calls."
Ok, then I have a broken glibc (glibc-2.1-0.990311). gethostbyname kept
allocating memory when resolving the same 10 host-names over and over again.
I implemented a cache in the program (which I probably whould have done in the
first place anyway) and that completely fixed the problem. gethostbyname() is
now only called _once_ for each host name.
> I assume there are thread safe versions kicking around somewhere too, but
> I've never used them so don't know how they work (do they alloc the struct
> and return it, or just use TLS?).
I'd guess that since the standard glibc is thread-safe now, gethostbyname()
will also be thread safe. But my program is single-threaded.
I was actually so convinced that it was a coding error by me, that I spent 10+
hours hunting this leak. It never occured to me that it could be
gethostbyname() leaking. After having run leaky (from the Mozilla people) on
some long runs with the program, I could see that the leaks were from
gethostbyname().
Thanks a lot,
................................................................
: [EMAIL PROTECTED] : And I see the elder races, :
:.........................: putrid forms of man :
: Jakob �stergaard : See him rise and claim the earth, :
: OZ9ABN : his downfall is at hand. :
:.........................:............{Konkhra}...............:
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]