curl / Mailing Lists / curl-users / Single Mail


Re: Memory increase with https requests

From: Daniel Stenberg <>
Date: Fri, 4 May 2018 14:34:42 +0200 (CEST)

On Fri, 4 May 2018, madana gopal wrote:

> We have a requirement that the app won't want to get exited, but want to get
> the memory freed on need. Do we have any way to handle this?


libcurl will only use as much memory as it thinks it needs and there's no way
to poke it and tell it to use less memory all of a sudden. You can possibly
tweak parameters etc to make it cache less data to somewhat reduce its memory
footprint, but I don't think you can shave off much that way. The TLS
libraries tend to consume way more memory than the rest of libcurl does.

The way libc usually works, it will grow the heap for the application
depending on need during its lifetime but it will not shrink it. Thus you
won't get the heap back "for real" until the program exits and the peak memory
amount will thus decide how large heap your application will have.

Received on 2018-05-04