Code segment unload: Difference between revisions

Added Wren blurb.
(Added Wren blurb.)
Line 120:
:Provided an interpreter is not the ''root'' interpreter in its thread, you can delete it from an ancestor interpreter, which releases all the memory associated with it back into the general memory pool.
:<lang tcl>interp delete theChildInterpreter</lang>
 
=={{header|Wren}}==
It is not currently possible to unload code from a running Wren script.
 
However, what you can do is to place code that will only be run once, such as initialization code, into a function and then call that. Functions (as opposed to class methods) are first class objects in Wren and will be garbage collected when there are no longer any references to them. This doesn't usually occur immediately but you can request an immediate collection by calling the ''System.gc'' method.
 
{{omit from|AWK}}
9,485

edits