git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH] http: use xmalloc with cURL

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 12, 2019, 19:23 UTC
Message-ID
<nycvar.QRO.7.76.6.1908122118020.46@tvgsbejvaqbjf.bet>
In-Reply-To
<CAPUEspg62pRNH6=_VvWDxQ4YujHUJAoTTampc0L4t68QMj30xg@mail.gmail.com>
Hi Carlo,
On Sun, 11 Aug 2019, Carlo Arenas wrote:
Show 18 quoted lines
> On Sun, Aug 11, 2019 at 4:20 AM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > On Sat, 10 Aug 2019, Carlo Marcelo Arenas Belón wrote:
> > > cURL is very strict about its allocator being thread safe and so that might
> > > be an issue to look for.
> >
> > Looks good to me.
>
> it is not ready yet for using though, at minimum I have to fix the #ifdef
> so there is no risky of breaking someone's build because they happen
> to still be using and old enough cURL (ex: 7.10)
>
> there is also the risk that xmalloc might not be sufficiently thread
> safe (ex: when it triggers unuse_one_window() through the use of a
> try_to_free_routine in packfile.c but we could mitigate the risk for
> now by doing it only first #ifdef NED (I promise to take it out before
> it even gets to next, assuming Junio would trust me enough after the
> last blow up to even get it into pu)

I was under the impression that we _already_ use `xmalloc()` in plenty of multi-threaded scenarios...

And yes, nedmalloc meets the demand: it is thread-safe. All allocators to be used by Git have to be.

> alternatively, getting some feedback from people that know that code
> better like Shawn, since I have to admit I haven't read it enough to
> be fully confident it is safe (although I believe it was enough, or I
> wouldn't had sent it for feedback otherwise)

If you are referring to Shawn Pearce (and I assume you do, because the other Shawn I found in the shortlog only worked briefly on `git clean` and `git p4`), I have the sad duty to inform you that he passed away.

> > Still, it is a good idea to ask libcurl to use the same allocator as Git.
>
> and it should have a positive performance impact, which should be nice
> to look for.

I actually do not expect any performance impact, given that communicating via HTTP(S) is partially a waiting game, in any case, the network will be the bottleneck, not allocating memory.

Ciao, Dscho

Previous: Carlo ArenasNext: Jeff King
Message 6 of 11 in “http: use xmalloc with cURL”
  1. http: use xmalloc with cURLCarlo Marcelo Arenas Belón, Aug 10, 2019
  2. Daniel StenbergAug 10, 2019
  3. Carlo ArenasAug 10, 2019
  4. Johannes SchindelinAug 11, 2019
  5. Carlo ArenasAug 11, 2019
  6. Johannes SchindelinAug 12, 2019
  7. Jeff KingAug 12, 2019
  8. Junio C HamanoAug 12, 2019
  9. Jeff KingAug 12, 2019
  10. Johannes SchindelinAug 13, 2019
  11. Jeff KingAug 14, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.