Let’s say I create a DistributedArray but then reassign the variable to a new one:
using Distributed
addprocs(1)
using DistributedArrays, LinearAlgebra
da = DArray([@spawnat wid LinearAlgebra.ones(div(1024^3, 8)) for wid in procs()])
# Total memory size should be 2GB
da = DArray([@spawnat wid LinearAlgebra.ones(div(1024^3, 8)) for wid in procs()])
Even if I run @everywhere GC.gc()
a few times, the first array is still not garbage collected.
How do I deallocate the first array for sure?
What if a DistributedArray is contained as a field inside some struct
: how do I make sure that this array is deallocated when the struct
is garbage collected?