correct alloc size + prefer std::copy over memcpy