cURL
Haxx ad
libcurl

Shopping cart software, Online file storage, Online photo storage, Hosted shopping cart, Contact management software, Email marketing software, Project management software, Issue tracking software, Online notepad, Web publishing software

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Archives

Re: What is the proper way to get libcurl to free it resources when used within a C++ Class?

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Tue, 24 Nov 2009 20:10:23 +0100

On Tuesday 24 of November 2009 19:53:04 Dantzler, DeWayne C wrote:
> That is exactly what I did. I placed the calls for curl_global_init() and
> curl_easy_init() in this order in a constructor and place the calls for
> curl_global_cleanup() and curl_easy_cleanup() in the destructor. In fact, I
> tried several different combinations in the destructor for the
> curl_global_cleanup()and curl_easy_cleanup() methods, but each combination
> had memory resource issues(see below). Now, I do call a 3rd party
> library(Xerces) that also uses the curl library.

Please keep the conversation on list.

You are doing something a bit different. It's not good idea to call
curl_global_init()/curl_global_cleanup() more than once for nothing. I know
there is something like a reference counter, but do not use it unless you
really need to. Basically it's not thread-safe and it can trigger a memory
leak under certain circumstances.

If you want to get more help from us, you'll need to write something like
a minimal example we can compile and run. Then it's easy for us to tell you
what's actually wrong in your code.

Kamil
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-24

These mail archives are generated by hypermail.

donate! Page updated November 16, 2009.
web site info

File upload with ASP.NET