Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <147337465.AQdONaE2Fp@tjmaciei-mobl5>
Date: Sat, 01 Nov 2025 08:03:19 -0700
From: Thiago Macieira <thiago@...ieira.org>
To: Alejandro Colomar <alx@...nel.org>, Florian Weimer <fw@...eb.enyo.de>
Cc: libc-alpha@...rceware.org, musl@...ts.openwall.com,
 Arthur O'Dwyer <arthur.j.odwyer@...il.com>,
 Jonathan Wakely <jwakely@...hat.com>
Subject: Re: realloci(): A realloc() variant that works in-place

On Saturday, 1 November 2025 06:05:57 Pacific Daylight Time Florian Weimer 
wrote:
> For the std::vector case at least, what applications want is some form
> of non-moving realloc that allows the application to specify an
> arithmetic progression and an interval, and the realloc variant should
> change the size of the allocation to an element of the arithmetic
> progression that resides within the specified interval, or fail.

That would indeed be better. When growing, the class doesn't know how many 
more items are coming, so a best effort from the runtime is welcome. There's a 
chance that the smaller allocation that the runtime was able to fulfill will 
suffice and thus we'll have avoided an extra relocation of the elements.

Wouldn't this be the xallocx() interface from jemalloc? It allows the caller 
to pass the number of elements/bytes it really needs and the number of 
elements/bytes it speculates it will need.

However, it's not necessary.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Download attachment "signature.asc" of type "application/pgp-signature" (871 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.