Subject: Re: [PATCH 04/22] reftable/basics: handle allocation failures in `reftable_calloc()`

From: Junio C Hamano <[email-masked]>
Date: Tue, 24 Sep 2024 09:39:04 -0700

Patrick Steinhardt <[email-masked]> writes:

> In any case, there's another, bigger elephant in the room: `struct
> strbuf`. I will have to introduce a reftable-specific buffer type for
> this such that we can handle allocation failures here, too.

Oh, that one.

If you are letting your callers to register allocation callbacks,
you'd want to make sure any code you use, in cluding strbuf, would
take pieces of memory from and return them to the registered
allocation routines.

> While the
> alternative would be to amend `struct strbuf` itself to do that, I don't
> quite think that we should do it in "core" Git itself for now.

Punting is of course an option, but what do the "libification" folks
want to see happen (Emily Cc'ed, not necessarily because she
personally did work in libification, but she knows who is responding
to the list this week)?  Wouldn't we eventually want these common
things not to die but to gracefully fail?