Re: Will TCL release the variables automatically when the procedure is finished?



In article <f33b8421-3dbd-4c05-b3ae-1024efd7f5ac@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
bingo <zhngbn@xxxxxxxxx> wrote:
.
.
.
Thanks a lot for your response.
Actually, I'm really not that clear about the relationship between C
code and TCL script. I'm guess (3) because the way how it works is:
(1) I can write some input files using TCL.
(2) NAMD will parse the input file and do the simulation.
(3) Another interesting thing is you can define a "proc" using TCL,
and ask NAMD to call that proc each step and get information.
Now the problem is that I got "OUT OF MEMORY" error while running
the proc I defined in TCL(and I can see the memory increasing each
step). At first I thought it could be that the variables in the proc I
defined are not freed. But I tried to unset them explicitly, and still
the same problem. Then I start to google and being a little desperate,
that's where I find the function "TCL_Finalize", which I don't
understand at all.
Any suggestion about the error will be greatly appreciated.
.
.
.
"Working too hard" is my label for this situation.

I understand the sense of what you've done. It's quite far
from the simplest possible, though.

Put away the source code at the level of TCL_Finalize().
You have done well to note that "memory increas[es] each
step". Is the [proc] you defined small enough that you
can reasonably write it here? If not, make it small!--
that is, simplify the system down to something minimal
that exhibits the bad memory behavior, but is small
enough to be understandable.

It's hard for a simple, small proc to run out of memory
without something obvious to correct.

We can get through this.
.



Relevant Pages

  • Re: function and structures
    ... C code and i have to rewrite the code in TcL. ... is to assign to it with a set command (or some other commands such ... probably the best way is to use a Tcl array. ... Functions are declared with the proc command: ...
    (comp.lang.tcl)
  • Re: function and structures
    ... lines,, i want to implement the same in TcL. ... is to assign to it with a set command (or some other commands such ... probably the best way is to use a Tcl array. ... Functions are declared with the proc command: ...
    (comp.lang.tcl)
  • Re: Call flow - tcl - menu ivr - array as fsm? better than if?
    ... number i've dialed, execute the TCL script. ... TCL would play prompts and, in the end and if applicable, transfer the ... Router calls the tcl script that is located on a machine which is ... proc act_Setup { ...
    (comp.lang.tcl)
  • Re: Want to know when a batch file is done
    ... have the twapi extension. ... use a simple polling loop. ... proc wait-for-done {... ... The use of update gets around the single threaded tcl ...
    (comp.lang.tcl)
  • trace error
    ... But there is one thing I find curious and I would like to ask you, if there happens to be a part of the API (TCL or C) that I have overlooked. ... proc A { ... But if I want to make sure I am notified of every possible TCL error before the stack unwinds, I would have to wrap catch around every single proc in my program. ... In the same lines as "trace add variable" or "trace add command" can register procedures which are called before or after something happens to a variable or proc, "trace error callbackProc" would register the name of a proc to be called when an error occurres, before the stack unwinds, and would be executed in the same frame in which the error occurred. ...
    (comp.lang.tcl)