cURL / Mailing Lists / curl-library / Single Mail


Re: Memory leak using multi handle

From: Dan Donahue <>
Date: Mon, 27 Jun 2016 20:21:10 +0000

Date: Mon, 27 Jun 2016 15:42:26 +0200 (CEST)
> From: Daniel Stenberg <>
> To: libcurl development <>
> Subject: Re: Memory leak using multi handle
> Message-ID: <>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
> On Mon, 27 Jun 2016, Dan Donahue wrote:
> > several files simultaneously. The only issue I am experiencing is
> > the memory 
> > leak. I have verified there are no leaks in my code.
> And the leak stays at this memory amount or does it grow over time?
Yes, the leak most certainly grows over time resulting in a crash. I
presented the simplest case here (1 file) in order to arrive at a
solution sooner. The hope is we fix one leak we fix them all.

>  It seems to imply that it is a multi handle that is never freed. It
> *could* be
> >
That's what I've concluded as well. However, we have verified
curl_multi_cleanup does not return an error code.

> a multi handle that's used privately within libcurl by an easy handle
> (because 
Why would an app's dynamically allocated multi handle be used
"privately" within libcurl? And why would a curl_multi_cleanup of the
handle indicate success when clearly it's not? 

How is an app to know its multi handle is being privately used by libcurl so it can clean it up some other manner? How is a privately used multi handle cleaned up?

> it looks like there's a hash there with three entries that also
> aren't freed).
Could the entries be allocated with each call to curl_multi_perform?
(Assuming it takes 3 calls to complete the transfer)

> Does your program ever run a transfer with the easy interface?
It does not.

> If you can, running the code with valgrind will probably give us more
> details 
> of where and how exactly the leaks occur.
In process. Will reply with results. 

List admin:
Received on 2016-06-27