cURL / Mailing Lists / curl-library / Single Mail

curl-library

Memory leak observed while using libcURL

From: RaJ M <smrajagopal_at_gmail.com>
Date: Fri, 27 Feb 2015 16:49:27 -0600

libcURL version used : 7.40.0 (cross compiled for arm-linux)

Followed instructions from http://curl.haxx.se/dev/readme-memoryleak.html
to capture the memory leak associated with libcURL.
I additionally had to add the following line in include/curl/curl.h to
get rid of undefined reference to curl_memdebug() compile error
CURL_EXTERN void curl_memdebug(const char *logname);

tests/memanalyze.pl has been used to analyze the output from libcURL
memory tracker. Attached both curl_memdebug output and memanalyze.pl
output containing the report on the leak. Ran valgrind separately and
attached that log as well

I will list out what I did with libcURL and what I want.

I have a restriction on number of HTTPS connections that can be
present at a time (max: 1) and at the same time, it shouldn't be a
blocking one. So I went on to use libcURL's multi API, options set are
CURLMOPT_PIPELINING : 1
CURLMOPT_MAX_PIPELINE_LENGTH : 2L
CURLMOPT_MAX_TOTAL_CONNECTIONS : 1L

One of my easy handles request take forever to end, as it continues to
receive data as response from my HTTPS server until disconnect. In my
testing, after I post the forever taking request and receive response
continuously, I add multiple other new HTTPS requests just to do HTTPS
POST (which actually doesn't expect a response) using a new easy
handle for each call towards curl_multi_add_handle() which turns out
to be successful (CURLM_OK) followed by continuous
curl_multi_perform() call which will succeed too.

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. 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 am not
confident if this is something that can be fixed at libcURL end or its just
my application that is missing out something.

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.

--
Thanks
Raja Gopal M
smrajagopal_at_gmail.com



-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2015-02-27