Way to reclaim recently unassigned variable?

Let’s say you’ve created some data object:

cur_dict = Dict()
for i in 1:10000
  cur_dict[i+rand()] = i

Then you fat finger the previous code again so that cur_dict is reset to Dict().

Is there a way to reclaim the cur_dict – that got over-referenced – before it gets garbage collected?

There’s no way to do this unless you have another name for the same data structure. (At least no way I know of, other than inspection of some very internal GC data structures.)

1 Like