Date: Mon, 2 Feb 2009 12:05:57 -0500
I just ran valgrind and found that all the non-cached connections were
leaked. I call curl_easy_cleanup for each handle and then
curl_multi_cleanup at the end. In curl_easy_cleanup, ConnectionDone is
called for the connection and lastconnect is set to connectindex
(which is -1). Could there be a legitimate leak here?
On Sat, Jan 31, 2009 at 7:16 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Fri, 30 Jan 2009, Patrick Scott wrote:
>>> All easy handles must be closed with curl_easy_cleanup() and the multi
>>> handle with curl_multi_cleanup().
>> I do call curl_easy_cleanup for each handle that finishes. What if I
>> can't call curl_multi_cleanup for a long time? Do those dangling
>> connections stick around until I do?
> Yes. The connections are either closed after use or cached in the multi
>> Where are they stored until they are cleaned up if they are not in the
>> cache (I'd like to do some hacking of my own around parallel connections and
> An easy handle is the "owner" of the connection until the transfer is done,
> and then it is handed back to the cache (which is kept in the multi handle
> by default when you use that). If the connection didn't fit the cache due to
> size restrictions it will instead get closed and all resources associated
> with it are freed.
>>> The curl_multi_perform() and curl_multi_socket*() functions all return
>>> the number of "active" transfers which is that number.
>> I can cap the number of requests I give to curl but how does pipelining
>> change that? Let's say I want to have a max of 5 simultaneous connections
>> with each connection able to pipeline its requests (if possible). How can I
>> make sure that I limit the number of connections to 5 without limiting the
>> number of requests?
> Oh, that is a very good question. Pipelining breaks the 1:1 assocation
> between requests (easy handles) and connections so yes when pipelining is
> enabled it isn't currently possible to figure out the number of connections
> using the API. I'm open to suggestions on how we can expose this information
> to apps!
> / daniel.haxx.se
Received on 2009-02-02