Forum OpenACS Development: Re: Can we use namespace variables to avoid upvar?

Collapse
Posted by Andrew Piskorski on
There is no conceivable way that not cleaning up namespace and global variables before the connection thread gets re-used could ever be considered a feature, it is just faster and simpler (and is the way AOLserver has worked all along). The decision there is simply one of standard Tcl namespace semantics vs. the existing simpler faster AOLserver code.

Therefore, if someone implements namespace cleanup in a manner which is clear, efficient, and optional, I can't imagine why the AOLserver maintainers wouldn't accept it. AFAIK the problem is that no one has attempted to implement it.

Collapse
Posted by Alfred Werner on
Does the ttrace package resolve any of this? The README in the aolserver directory seems to indicate that it's designed to optimize thread initialization.
Collapse
Posted by Andrew Piskorski on
Alfred, I don't think Zoran intended ttrace to address this per-thread namespace cleanup issue at all. In fact I think what it does is sort of exactly opposite. If I remember right, ttrace hooks into Tcl's 'uknown' command to find procedure definitions and things which don't exist yet in the current thread. The benefit of that is it lets you greatly decrease AOLserver server and thread startup times in some cases, and maybe it can tend to reduce the memory footprint too (I don't remember).

On the other hand, What Jon G. and others would like here, is some sort of removal of left over global and namespace variables from the thread when each connection request completes its processing.

It wouldn't hurt to ask Zoran about it though, he's likely to have some ideas.