cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: DNS cache size control

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 22 Apr 2002 09:00:34 +0200 (MET DST)

On Fri, 19 Apr 2002, Jacky Lam wrote:

[I'm sorry it took a few days to get back on this subject.]

> Here is a patch to use adaptive buffer size in DNS cache. However,
> i) I haven't test Solaris through I make changes to it.

I'll test and adjust it accordingly for Solaris.

> ii) I can't find man page of gethostbyname_r in AIX platform, so it is just
> the same as before.

Yes, that function call has no size argument so this "fancy" operation can't
be done for the 3-argument gethostbyname_r() unixes.

Just a question (in which I haven't investigated much myself): you chose to
decrease the size of the previous malloc() using a realloc() after the
resolve is done, instead of using realloc() multiple times to enlarge the
buffer.

While this is certainly a faster operation than enlarging the buffer would
be, is it as effective? I mean memory-wise. Real-world malloc implementations
taken into account.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-04-22