Re: trouble with mem sucking slave interps



Matthias Kraft wrote:
I have the situation now were my application creates several slave
interpreters (even recursive) and after using deletes them again.

But as it seems deleting a slave does not mean any memory gets
freed?! This is an observation with Tcl 8.4.1 on Solaris. I will try
to setup something in ActiveTcl 8.4.9 tomorrow.

I looked into this as the application is running for a while and
soaked up more and more memory. When the final [exit] in the main
interp got called it took several minutes before the shell prompt
returned.

Is there anything I can do about it? Maybe before deleting the slave,
[unset] on all variables or something?

I'd be curious what you do, and what might be left behind. For the most part, interps clean up after themselves (freeing all commands and vars created). Using 8.4.9 I ran loops of 1000 { interp delete [interp create z] } and saw no mem loss. Note that the creation of each interp creates commands, procs, vars, etc. in initialization.

--
  Jeff Hobbs, The Tcl Guy
  http://www.ActiveState.com/, a division of Sophos
.



Relevant Pages

  • Re: Maximum (practical) number of threads?
    ... Doesn't Tcl use POSIX threads? ... Tcl's memory model makes it very easy to design a threaded ... A small one meg interp times 1 million is ...
    (comp.lang.tcl)
  • start of text section in the ELF executable and in the Virtual Memory
    ... I've a generic question about how the program looks before and after it is ... loaded into the memory. ... that there is a section named `.interp` starting at 0x8048134 and not ... instruction at address 0x8048000. ...
    (freebsd-hackers)
  • Re: Slave interpreters, aliases, and upvar
    ... to use upvar to access variables in the slave? ... set interp ... upvar 1 $_var var ...
    (comp.lang.tcl)
  • Re: tcltest Tk Applications
    ... puts command which would redirect all stdout/stderr output to the master interp, and use the default puts command for everything else. ... I resolved the issues with non-standard files too and fixed a problem that had been created when defining the alias for puts. ... I've attached the complete setup for using slave interps with tcltest to this message. ...
    (comp.lang.tcl)
  • Re: How to un-source ?
    ... You may use separate interpreters for each source command, ... interp create slave ... slave eval source x.tcl ...
    (comp.lang.tcl)