Is there any relationship between Julia's lexical scoping and garbage
collection?

What I mean is: if I have a function inside which is a variable which is
not used from some point onwards in the function, does the object live on
until the end of scope or is it possible that it may be gc'd before the end
of the scope of that variable?

Obviously I'm asking because we want to keep an unsafe pointer to the
internals of some C object which is only used inside that function, but
possibly after the last use of the Julia managed object.

Shorter version of question: how does Julia decide when it is safe to clean
up a an object bound to a variable that is still in lexical scope?

(I realise of course that if the variable in question is assigned some
other value there is no longer a valid reference to the object and all bets
are off.)

Bill.

Reply via email to