That won’t work since you overwrite integs
. You need to understand what the culprit is here: your original CuArray
s are collected because no reference to them is live, as you overwrite integs
(which used to contain instances) with pointers to those arrays (which don’t keep the array alive).