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.

Re: Fewer mallocs is better, episode #47

From: Daniel Stenberg via curl-library <>
Date: Fri, 28 Jan 2022 15:00:37 +0100 (CET)

On Thu, 27 Jan 2022, Gavin Henry via curl-library wrote:

> Yes, it was strlen. My apologies. They switch to berval types:

For the fun of it I checked curl's use of strlen in a typical invoke like
shown before. "curl -Ls" (which includes a redirect)

Counting all uses with ltrace, also including OpenSSL etc.

It then makes around 686 calls to strlen(). The *total* size was 7826, thus
the average call is for strings less than 12 bytes long. The longest returned
value is 36 (*) The median length is 10.

Conclusion: I'm not seeing a general strlen problem in curl.

(*) = this is the longest SAN name returned in the server cert

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