[CM] Freeing up s7 instances & memory
bil at ccrma.Stanford.EDU
bil at ccrma.Stanford.EDU
Tue Sep 8 05:46:26 PDT 2020
I think you misunderstood my suggestion. It has nothing to do
with mutexes or threads. Take repl.scm for example. It has a
top-level-let, initially (inlet), or its equivalent (sublet (rootlet)).
All evaluation and loading by default takes place in that let, not
the rootlet. So:
/home/bil/cl/ repl
<1> (define x 32)
32
<2> (defined? 'x)
#t
<3> (defined? 'x (rootlet))
#f
<4> (set! (*repl* 'top-level-let) (inlet))
(inlet)
<5> (defined? 'x)
#f
So by resetting top-level-let we're back to the pristine start-up
state, just as if we had freed the initial repl and started a new one.
There are a few tricky points involving the built-in hooks, but you
can save their startup state, and re-establish them when you clear
out the top-level-let. In the multi-s7 case, I'd have a pool of
s7's. There are no mutexes in s7.c (except some that Kjetil uses
for debugging).
More information about the Cmdist
mailing list