D-Programming-Language/druntime — pull request #1071 by schveiguy (2014-12-19 19:17:39+00:00)
Title: Fix issue 13854 --  Appending to an interior slice of a large array results in unnecessary 16-byte offset

When working with an existing block that is PAGESIZE or more, there was an optimization to always assume LARGEPAD and that we needed the offset. However, if the slice appended to was being reallocated to prevent stomping, and the new size fits into a smaller block, then the 16-byte offset is not only not required, but puts the array size in the wrong place.
This new code pushes all code paths through the same spot where the allocation and update to the new block is done correctly based on the new size.