cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Memory leak observed while using libcURL

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 2 Mar 2015 00:42:03 +0100 (CET)

On Fri, 27 Feb 2015, RaJ M wrote:

> While all of this happens, every new HTTPS request which are sent after the
> forever
> HTTPS request/response, (through curl_easy_init() and other allocs) would
> eat up resources which will never be released as that easy handle state
> will be set to CURLM_STATE_CONNECT_PEND and stays there.

Never? So what happens if you call *cleanup on all easy handles and the multi
handle? Is that memory truly lost?

> No way to drop the request and release the resources if the easy handle
> doesn't get to get a connection at all after a period of time (possible
> timeout) ?

I would say that the connect timeout should be used for that. Isn't it being
acknowledged?

> SideQuestion: May be not possible but just wondering, using libcURL, is
> there any way to do multiple HTTPS Post (which doesn't expect data back)
> while one of the in-progress easy handle still receives data from HTTPS
> server and as well with the restriction of maximum one connection towards
> HTTPS at a time.

No, pipelining is only possibly for "idempotent operations", which POSTs by
definition are not so POST requests cannot be done pipelined. libcurl then has
to wait for the first request to end before it can send the next one.

Then, even if you would send a GET instead, libcurl will of course expect a
response to it because that is simply how HTTP works so removing a response
makes it another protocol that libcurl doesn't speak.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2015-03-02