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 08:01:36 +0100

On Tuesday 24 of November 2009 02:17:53 Kamil Dudka wrote:
> On Tuesday 24 of November 2009 01:50:02 Dantzler, DeWayne C wrote:
> > I'm using libcurl with C++ classes in a single threaded application by
> > setting up the curl env in the constructor and invoking cleanup operation
> > in the destructor, but I'm having trouble freeing the allocated memory. I
> > read the curl documentation and tutorial. What is the correct method of
> > freeing resources?
>
> It doesn't matter what programming paradigma are you actually using. Just
> call curl_global_init()/curl_easy_cleanup() once per whole program. A

s/curl_easy_cleanup/curl_global_cleanup/

> singleton might be a good candidate if you like clean object-oriented
> design?
>
> Then for each curl_easy_init() you should call one curl_easy_cleanup(). You
> can wrap it to class and call the functions in its ctor/dtor. Or perhaps
> use cURLpp binding which does the job for you?
>
> 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