[musl] realloci(): A realloc() variant that works in-place

Rich Felker dalias@libc.org
Sat Nov 1 01:03:09 GMT 2025


On Fri, Oct 31, 2025 at 12:16:39PM +0000, Thorsten Glaser wrote:
> Alejandro Colomar dixit:
> 
> >A discussion within the C++ std-proposals@ mailing list triggered the
> >discussion about the need for a realloc() variant that works in-place,
> >that is, that doesn't move the address of the memory, and thus that
> >doesn't invalidate existing pointers derived from it.
> 
> How is that supposed to work if you want to grow the
> allocation?
> 
> This seems like increasing burden on the implementation
> for everyone, just for niche corner use cases.

Asymptotically, in-place realloc never works.

Rich


More information about the Libc-alpha mailing list