From: Robert Brunner (rbrunner_at_uiuc.edu)
Date: Thu Jun 07 2007 - 14:32:44 CDT

Well if you really want to delete all variables, I think this will work:

foreach v [ info vars ] { unset $v }
unset v

HOWEVER, there are some variables that tcl and vmd probably need to
function correctly. If you use this code, weird things will happen.
Maybe you could write your script in a namespace, and use the info
vars command to just delete the variables you've created.

I'd guess that opened files are handled inside of the Tcl interpreter
code, so simply unsetting the file variable won't do anything to
close the file. You really need to close the file or quit the Tcl
interpreter (which would let the OS close the files)

Robert

On Jun 7, 2007, at 11:46 AM, lily jin wrote:

> case 1:
> I was writting a script. Because of some bugs it ran but only
> partly. So some file opened was not closed. When I tried to delete
> the file from the folder, I was told it was used.
> case 2:
> when I use 'lappend lista $h ' in my script, I want to be sure that
> lista is empty when I start to run the program. I can use 'set
> lista {}' . But when I have a lot of commands like this in the
> script, I wish to have a clean memory with one command.
> I always want to have a clean memory before I ran a program.
> When this happend, especially case 1, I had to close VMD and start
> it again.
> 'clear' is a command in Matlab which simply cleans the memory.
> TCL has a command 'memory' which seems similar, however, it is not
> working in VMD1.8.5. I don't know if I made a mistake.
>
> Thank you for helping!
>
>
>
> Lily