Via private email, Rusty pointed me toward the connsperthread, which
does just what I need for my tcl bloating.
It's discussed at
http://www.mail-archive.com/[email protected]/msg01525.html
Can I suggest changing the default comment on the default config
file, which is currently this:
#ns_param connsperthread 0 ;# Normally there's one conn
per thread
the "Normally there's one conn per thread" comment seems incorrect to
me and makes this parameter sound like it's about one connection
feeding many web pages at once, which is not what it is at all, but
rather an anti-tcl-bloat feature.
Note also that many modern OSes don't return memory to a process
until a thread exits, in order to minimize semaphore locking around
malloc() (Windows does this, and I think Solaris has added it too)
-john
On Aug 31, 2006, at 10:55 AM, John Buckman wrote:
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.