Memcpy() is a C standard library function used for copying a block of memory bytes from one place to another.
C library function for reallocating a dynamically allocated memory region.
"As you can see from the above tests realloc is consistently faster compared to memalloc memcpy and free"
from question "C++/ActiveX replacing realloc with malloc, memcpy, free. Functional and Performance tests"
"As we can see copying manually with memcpy is always slower than realloc because in this scenario malloc is guaranteed to allocate new memory and you re forced to copy the data in every allocation which shows us that realloc is indeed reusing the same address and enlarging the block size in some cases"
from question "Differences between using realloc vs. free -> malloc functions"