cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to reduce libcurl memory usage

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 27 Jan 2014 07:54:59 +0100

On Mon, Jan 27, 2014 at 02:28:47AM +0000, Zhao, Fei wrote:
> This is Fei from EchoStar. We are tring to use libcurl in our low-end setbox which has memory limitation.
>
> It seems curl_easy_init() will allocate a lot of memory and the memmory can't be released after curl_easy_cleanup().
>
> If I call curl_easy_init() to initialize curl handles in 5 threads, the memory usage by curl will be 3 MB which is too much for the low-end setbox.
>
> What I need from curl is just the HTTP protocol.
> Is there any way or any configuration which I can use to reduce the memory usage by curl?

There's a section in docs/INSTALL about reducing the binary size. You can make
an HTTP-only libcurl that's 114 KiB, for example. There's not a lot you can do
to reduce the dynamic data requirements, but then libcurl doesn't use a lot,
either. You can reduce CURL_MAX_WRITE_SIZE, but that will save on the order of
KB, not MB.

> I tried to disable SSL. It seems don't work.

Then you did it wrong!

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-27