The malloc function performs dynamic memory allocation in C and is part of the standard library
Memcpy() is a C standard library function used for copying a block of memory bytes from one place to another.
"Afaik malloc is not slower than memcpy"
from question "Is cudamalloc slower than cudamemcpy?"
"This allows you to use the assignment operator instead of memcpy and requires 1 less call to malloc - the one you make"
from question "Why is memory still accessible after std::map::clear() is called?"