When you wrap up a load of C/C++ code and use it as a Tcl shared object extension, you often find yourself coding large, ungainly *TclC* procedures which make much use of pointers. I found it useful to write a '''defaultDestructor''' procedure to do a final cleanup of pointers created in procedure context: proc defaultDestructor { { level 1 } } { set msg "defaultDestructor:" set vnames [ uplevel $level info vars ] foreach vname $vnames { ;## dereference set vname [ uplevel $level set $vname ] if { [ llength $vname ] > 1 } { continue } switch -regexp -- $vname { {^_[0-9a-f]+_Frame_p$} { set seqpt "destructFrame($vname):" if { [ catch { uplevel $level destructFrame $vname } err ] } { lappend msg "$seqpt $err" } } {^_[0-9a-f]+_Element_p$} { set seqpt "destructElement($vname):" if { [ catch { uplevel $level destructElement $vname } err ] } { lappend msg "$seqpt $err" } . . more of the same elided... . {^_[0-9a-f]+_FrameFile_p$} { set seqpt "closeFrameFile($vname):" if { [ catch { uplevel $level closeFrameFile $vname } err ] } { lappend msg "$seqpt $err" } . . even more elided! . } ;## end of switch } ;## end of foreach if { [ llength $msg ] > 1 } { return -code error $msg } } ---- If it is not too much to ask, could you please supply a bit more context on what the purpose of this code fragment is? Sure, I can see what it is doing ''per se'', but I have no feeling for why it should be doing this. I happen to believe the ''why'' of things is extremely important, since it is what determines the ''what'' of things... '''DKF'''