No, you do not need to free your local vars when you exit the procedure. They are automatically released. In most cases this happens, but there are exceptions (some extensions may require you to explicitly release things, and some packages, especially http, create tokens that need to be cleared)
If you create large arrays in the global namespace, they will not be freed, as they can still be accessed.
There is no problem using arrays in tcl, but make sure you use the right tool. In tcl, an array is an "associative array", that is, indexed by a string. If you need a c-style array indexed by an integer, a simple old list might be better (you can pass it by value), but you can take it a little awkwardly (subscriptip is a command, not a reference to a variable with a unit)
source share