curl-library
RE: Possible memory leak in libcurl?
Date: Wed, 12 Jun 2002 11:55:51 -0700
Hi,
Thanks for the reply. There is only one host that I connect to, only the URL
changes everytime which is why I am unable to understand why the cache keeps
growing. Also since I use the same handle all along, there is no new
connection made to the server.
I have run these tests for a fairly long period - in fact I have monitored
the sample program I sent earlier to make 1000 FTP listings on one handle...
and the heap size keeps growing. A small section of the analyzed memory dump
looks like:
At 454594, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/llist.c:63
At 14b2cbc, there's 9000 bytes.
allocated by /install/curl-7.9.6/lib/hostip.c:444
At 4515a4, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/hash.c:127
At fcfb0c, there's 9000 bytes.
allocated by /install/curl-7.9.6/lib/hostip.c:444
At 43e234, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/llist.c:63
At 4246b4, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/hash.c:127
At 45a274, there's 17 bytes.
allocated by /install/curl-7.9.6/lib/hash.c:128
At 448d24, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/llist.c:63
At 429e54, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/hash.c:127
At 445e94, there's 8 bytes.
allocated by /install/curl-7.9.6/lib/hostip.c:203
At 440044, there's 17 bytes.
allocated by /install/curl-7.9.6/lib/hash.c:128
At 44ea04, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/llist.c:63
At 435bb4, there's 17 bytes.
allocated by /install/curl-7.9.6/lib/hash.c:128
At 42ee04, there's 8 bytes.
allocated by /install/curl-7.9.6/lib/hostip.c:203
At 42fb34, there's 8 bytes.
allocated by /install/curl-7.9.6/lib/hostip.c:203
At 44ae44, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/llist.c:63
At 44bb74, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/llist.c:63
At 45d7c4, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/hash.c:127
At 43e8f4, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/llist.c:63
At 430c14, there's 12 bytes.
allocated by /install/curl-7.9.6/lib/llist.c:63
At 4442c4, there's 12 bytes.
Is there is a hashing bug in this version, or would upgrading to 4.9.7 make
no difference?
TIA,
Gautam
-----Original Message-----
From: Daniel Stenberg
To: Gautam Mani
Cc: 'libcurl Mailing list '
Sent: 6/12/2002 10:41 AM
Subject: RE: Possible memory leak in libcurl?
On Wed, 12 Jun 2002, Gautam Mani wrote:
Oh. You're using 7.9.6, right? There's no pruning of old entries in the
DNS
cache there so it can theoreticly continue growing if you continue to
use new
host names all the time...
> I have attached a small section of the mallocdebug trace (taken on
Win32).
> Please notice that the allocations of 9K which happen in hostip.c:444
are
> not released till the cleanup method is called. I tried to look into
the
> code; but since my understanding of the internals is still very basic;
I am
> finding it difficult to find a solution.
Those are name lookup buffers. In 7.9.7 we have not only DNS cache
pruning,
but also Jacky Lam's neat "shrink-dns-buffers" fixes that makes each
single
name resolved information use less space even while in the cache.
> Is this name lookup allocation required everytime... or can it be
avoided?
If you use name based URLs libcurl needs to resolve the name.
> Why is the buffer not freed till cleanup is called?
This is a flaw/feature in libcurl 7.9.6 that we fixed in 7.9.7. ;-)
_______________________________________________________________
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
Received on 2002-06-12