Arrays of arrays and arrays of structures in CUDA kernels cause random errors

That won’t work since you overwrite integs. You need to understand what the culprit is here: your original CuArrays 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).