Fix triangulate bad memory reference

Transfer memory references after calling triangulate.

Needs review from @cekees and @mfarthin