On my bookmooch.com site, I'm noticing that my nsd process adds about 300mb of memory usage every day, requiring a restart once a week after I approach my 2gb memory limit. I'm trying to fix this.

One theory I have is that the Tcl interpreters are slowly bloating.

A simple test.adp page I made with a bunch of tcllib package requires, followed by package forgets, slowly bloats up.

Apache mod_perl deals with this kind of problem by occasionally killing an interpreter and reloading it. Is there an automated way to do the same thing in Aolserver?

I've written this function below, which uses ns_markfordelete and a namespace global to kill the current tcl interpreter every 100 runs.

namespace eval runtimes {}
proc check_if_should_cleanup_interp {} {
        global runtimes::runcount
        if {[info exists runcount] != 1} {
                set runcount 0
        }
        incr runcount
        puts "Tcl Interp run count: $runcount"
        if {$runcount > 100} {
                puts "marked tcl interpreter for deletion"
                ns_markfordelete
        }
}


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to