On 8/03/2025 4:37 am, Henry Miller wrote:
On Wed, Mar 5, 2025, at 16:06, Matt Bentley via SG14 wrote:
However, if the assigned range is smaller than capacity, would capacity 
be expected to decrease? Or rather, what would /you /expect to happen? 
Leave capacity as-is, avoid deallocations and put the burden on the 
developer to call trim()? This has implications for whether or not 
assign does the right thing by cache locality ie. maintaining the 
minimum number of larger contiguous blocks, or by allocation/deallocation.
If assign knows the final size it may deallocate all blocks and allocate one new block that is larger than the current capacity, even though all the data would fit in the current capacity (across 2 blocks).  I doubt any would in the real world, but I would not be surprised.


Valid point, thanks. I don't think I'll implement it this way, but it gets around what I was talking about.