My understanding is that under some "huge" size, jemalloc returns
allocations from particularly-sized buckets.
This makes me expect that realloc() between bucket sizes is going to
always copy the data instead of just adjusting allocated metadata,
because to do otherwise would mess up the bucketing.
Is this so? Specifically, is it actually useful that nsStringBuffer
uses realloc() as opposed to malloc(), memcpy() with actually
semantically filled amount and free()?
Upon superficial code reading, it seems to me that currently changing
the capacity of an nsA[C]STring might uselessly use realloc to copy
data that's not semantically live data from the string's point of view
and wouldn't really need to be preserved. Have I actually discovered
useless copying or am I misunderstanding?
dev-platform mailing list