curl-library
RE: Possible memory leak in libcurl?
Date: Thu, 13 Jun 2002 02:36:49 -0700
Hi,
Thanks for being patient with me :).
I ran the small test program with 1000 iterations and the memory used (not
leaked!) was 138559 bytes and when I did the same for 10000 iterations it
was 138913; so I guess that closes the issue.
Yes, everytime a new cache entry is being created since the port number
varies everytime. So, creating an entry with just the hostname would be
useful.
Thanks & Cheers,
Gautam
-----Original Message-----
From: Daniel Stenberg
To: Gautam Mani
Cc: libcurl Mailing list
Sent: 6/13/2002 12:09 AM
Subject: RE: Possible memory leak in libcurl?
On Wed, 12 Jun 2002, Gautam Mani wrote:
> I have upgraded to 4.9.7 and it looks better ...
It is called 7.9.7! :-)
> although there is still a small leak - it is still at the same place;
and
> memanalyse of a small section gives me:
I wouldn't call it a "leak" since the memory is fully tracked and is
removed
fine when you use curl_easy_cleanup().
<snip>
Curl_getaddrinfo() gets called from Curl_resolv().
Curl_resolv() is the generic resolver-function used within libcurl. It
is
protocol independent and it manages the DNS cache and stuff too. It
means
that it should use cached information if there is any, or use
Curl_getaddrinfo() to resolve the name if there's nothing in the cache.
To track this down, you should set a break-point in Curl_resolv() and
see
what it does on two invokes using the same name and port.
To reduce the amount of memory used for the DNS caching, you can disable
the
cache completely or you can set the DNS cache time to a minimum. It will
of
course also give you higher risks of resolving the same DNS names
multiple
times instead of just re-using the cache entries.
Hm. It strikes me here and now, that we cache names and port
combinations as
that's what we need to do for IPv6 stacks, but there's an improvement
for
IPv4 stacks to be made here. It could very well cache on names only and
thus
reach better results on repeated uses with FTP (since FTP tends to give
lots
of different port numbers for the data connection).
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink
Received on 2002-06-13