curl-library
[PATCH] Re: libcurl memleak
Date: Wed, 30 Oct 2002 07:58:54 +0100 (MET)
On Tue, 29 Oct 2002, Avery Fay wrote:
> curl_easy_setopt(curl, CURLOPT_DNS_CACHE_TIMEOUT, 0);
>
> I did this originally because I was having sporadic crashes in libcurl's
> DNS cache code.
Hm. We need to get that looked into if that is the case still.
> At one point, I tried setting CURLOPT_DNS_USE_GLOBAL_CACHE to 0, but I ran
> into other problems doing that.
Yes, you can't use that multi-threaded.
> Anyway, my program never resolves names so I figured using a cache wouldn't
> help much (I give URL's like http://10.0.0.1/, etc.).
I agree that it makes sense. However, after checking out things, there is no
good way to free the data unless it is stored in the cache, as the code is
written now. Thus, I ran your test program without any memory leak after
having done minor patch shown below. I'm of course interested in knowing if
this fixes your problem.
diff -u -r1.75 hostip.c
--- lib/hostip.c 21 Oct 2002 13:20:30 -0000 1.75
+++ lib/hostip.c 30 Oct 2002 06:55:29 -0000
@@ -218,11 +218,13 @@
}
#endif
+#if 0
/* If the host cache timeout is 0, we don't do DNS cach'ing
so fall through */
if (data->set.dns_cache_timeout == 0) {
return Curl_getaddrinfo(data, hostname, port, &bufp);
}
+#endif
time(&now);
-- Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs. ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sfReceived on 2002-10-30