backport: misc changes related to destination
removing sendmem, allocating on heap instead.