Earlier quoted context omitted.
It's the same with realloc: there is no guarantee that it will grow the chunk in place.
In reply to sibling posts. - if you need dynamic storage you should use a std::vector instead of new []. - with std::vector-s, if you want to save the cost of the copy you can redefine the vector allocator to use realloc or even mremap. Edit @xroche: For example, you can create an allocator that manages an initial chunk of memory (allocated with malloc) and grows it when it's required using realloc inside the 'alloca…
Edit² @bnegreve: but how do you handle moved blocks then ? And this would involve copying all objects anyway, because this is the std::vector's logic to allocate+memcpy+deallocate when the capacity is reached. The only solution is to ... rewrite std::vector, which is precisely what FB did :)