On 11/15/16 7:33 PM, L. A. Walsh wrote: > --- > That's fine -- I was just reading the comment about how 4.4 changed > history allocs to optimize memory reallocs and movement. So if things > were fine with malloc before, I'm not sure why they were optimized > within bash in 4.4...?
In the general case, realloc has to (internally) allocate a new block, copy the contents from the old block to the new one, and free the old block. Reducing the number of reallocs reduces the number of potential memory copies, which improves both memory locality and speed. This doesn't have anything to do with aligning requests for memory on page boundaries, which as Eduardo correctly notes, is the responsibility of the malloc library layer. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/