Re: [PATCH 0/4] reftable: fix out-of-memory errors on NonStop
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 21, 2024, 17:43 UTC
- Message-ID
- <xmqqy109aq4a.fsf@gitster.g>
- In-Reply-To
- <BL3PR17MB6020D6CB8712F2C6F36FC8CFF4002@BL3PR17MB6020.namprd17.prod.outlook.com>
Randall Becker <randall.becker@nexbridge.ca> writes:
> Thank you for this series. I think the problem may not be limited > only to NonStop based on the documented ambiguous behaviour of > malloc.
Yes, an implementation is allowed to return NULL when asked to allocate 0 bytes. On the Git side, we sidestep the problem in exactly the opposite way---our malloc() wrapper makes another request to allocate 1-byte block after seeing NULL from a request for 0-byte allocation. The reftable code takes an approach to eliminate the need to requiest 0-sized allocation in the first place, which is an arguably more valid solution.
Thanks, both, for finding and fixing the issue.