cURL / Mailing Lists / curl-library / Single Mail

curl-library

Fwd: Re: DNS cache size control

From: Jacky Lam <sylam_at_emsoftltd.com>
Date: Thu, 18 Apr 2002 10:12:00 +0800

Subject: Re: DNS cache size control
Date: Thu, 18 Apr 2002 09:57:57 +0800
From: Jacky Lam <sylam_at_emsoftltd.com>
To: "P J" <pj2k_at_hotmail.com>

On Thursday 18 April 2002 09:18, P J wrote:
> eek, 6M for 150 websites? how can I find out how much memory libcurl is
> using? I'm running the same script multiple times. How do I find out the
> memory libcurl is using in each instance? or for all of libcurl?

        I use ccmalloc to detech unfree memory.
        For each DNS reply, libcurl allocate 9000bytes , ~10Kb. For each websites,
there are four DNS queries. The result is 10K*150*4 = 6M.
        I am already using global dns cache. If not, the total memory usage of each
instance may be more.
        However, it won't affect you if you are not using global cache and not
reusing the handle frequently.

Jacky

> Thank you.
>
> > It seems only kept in memory.
> >
> >Jacky
> >
> >----- Original Message -----
>
> From: "Phil Stevens" <ozzigold_at_hotmail.com>
>
> >To: <curl-library_at_lists.sourceforge.net>
> >Sent: Wednesday, April 17, 2002 3:06 PM
> >Subject: Re: DNS cache size control
> >
> > > Hi,
> > >
> > > Whereabouts in linux is the file that stores the libcurl cache?
> > >
> > >
> > > Thanks.
> > >
> > > > Is it possible to add some control on DNS cache size? Especially, the
> > > >global
> > > >one? I use global size and run through 150 websites and fnd that the
> >
> >dns
> >
> > > >cache size grow to more than 6M!!! There are two reasons:
> > > > i) Libcurl won't remove some old expired dns cache
> > > > ii) Libcurl will alloc 9000bytes to hold dns answer. However,
> >
> >normally,
> >it
> >
> > > >just use 500-600bytes. (on Linux with gethostbyname_r).
> > > >
> > > > I solve the second problem by using an adaptive buffer size which
> >
> >reduce
> >
> > > >the
> > > >dns cache size to 1/10 of the original. For the first problem, I can
> >
> >only
> >
> > > >destroy all handles and call global_cleanup. Is there any alternative?
> > > >
> > > >Jacky
> > >
> > > _________________________________________________________________
> > > Get your FREE download of MSN Explorer at
> >
> >http://explorer.msn.com/intl.asp.
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com

-------------------------------------------------------
Received on 2002-04-18