core: use memcpy and reserve function

newMem is a new memory allocated by "new". There is no way that is
overlap with previous allocation. Therefore the faster memcpy can be used safely.