cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Boost::thread and libcurl

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Sat, 30 Apr 2011 08:45:14 -0700

On Fri, Apr 29, 2011 at 05:30:03PM -0700, Radu Brumariu wrote:
> I have a small app written in C++ using boost::thread and in each
> thread I GET a url and then collect the TOTAL_TIME for the call.
> For some reason, the total time to complete the request is getting
> higher in direct proportion with the number of threads(however, the
> start time, doesn't fluctuate the same way ) :

If the attached code was the complete example, then it's missing some
things. For one, curl_global_init() must be called before the threads
are created. For another, the handle is not being cleaned up after the
transfer, so not only is memory being leaked, but sockets and various
kernel network resources as well. You don't say what platform you're
using, but it's conceivable (though unlikely) that this might be enough
to slow down a poorly engineered system.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-30