curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Fewer mallocs is better, episode #47

From: Daniel Stenberg via curl-library <>
Date: Wed, 26 Jan 2022 10:23:51 +0100 (CET)


Just wanted to share this fun fact with you all.

Here's my test command line:

     curl -sL -o /dev/null

I ran this command line with 4 recent curl versions and I counted the total
number of allocations (using the script shown below). These are only
allocations done by curl and libcurl code, the dependencies' allocations are
not included.

  * 7.70.0

  Allocations: 415 Maximum allocated: 239432

  * 7.78.0

  Allocations: 391 Maximum allocated: 201926

  * 7.81.0

  Allocations: 391 Maximum allocated: 201700

  * 7.82.0-DEV (as of git master right now)

  Allocations: 174 Maximum allocated: 201684

This is a 55% reduction in number of allocations from 7.81.0 (while
maintaining and even shrinking the max amount a tiny bit)! The bulk of this
improvement comes from this single commit:

The test script, requires a curl built debug-enabled:

export CURL_MEMDEBUG=$HOME/tmp/curlmem.log
./src/curl -sL -o /dev/null
./tests/ -v $HOME/tmp/curlmem.log

  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
Received on 2022-01-26