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

Thiago Macieira thiago@macieira.org
Tue Nov 11 21:59:19 GMT 2025


On Tuesday, 11 November 2025 12:51:28 Pacific Standard Time Rich Felker wrote:
> What is the actual problem folks are trying to solve?
> 
> Has that ever been stated clearly?

Yes, more than once: growing a container (array, usually) that holds objects 
with non-trivial copy/move operations. realloc() is unsuitable for that 
because the elements can't be memmove()d, so containers today must allocate a 
new buffer, perform the expensive move, then free the old buffer.

> Is it a single problem or multiple ones that keep getting raised
> because they seem vaguely related to the topic?

There are a few incidental requests, like finding out how big a buffer realy is, 
when the allocation happens.

> Multiple people who are not participants in this thread but who have
> seen it have told me it looks like something out of the Simple
> Sabotage Field Manual and are frustrated to see myself and others
> having our time wasted on it.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 870 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20251111/c7e20f75/attachment.sig>


More information about the Libc-alpha mailing list