From: SourceForge.net <no...@so...> - 2005-07-25 16:07:06
|
Feature Requests item #1241351, was opened at 2005-07-20 08:02 Message generated for change (Comment added) made by vasiljevic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1241351&group_id=130646 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Stephen Deasey (sdeasey) Assigned to: Stephen Deasey (sdeasey) Summary: Allocate single interp per-server per-thread Initial Comment: When some C code want to run some Tcl code it first calls Ns_TclAllocateInterp(server) to get an interp. Interps are de-allocated and cached per-thread (per-server) for the next allocation. If there is no cached interp, a new one is created. This can also happen when there was a cached interp but it has already been allocated. Recursive allocation can happen e.g. when a script registered with ns_register_proc (which allocates an interp to run the script) calls the command ns_pagepath (which may allocate an interp to run a registered Tcl callback). Then end result is that more than one interps per-thread per-server can be allocated, the number depending on the ammount of recursion due to Tcl callbacks. This is bad from a memory point of view and a speed point of view as interp traces run each time an interp is allocated. Attached is a patch which implements reference counting on NsInterp structures. Interps are only allocated fresh if no interp has yet been allocated for that thread. If an interp has already been allocated, the reference count is incremented. The refcnt is decremented on de-allocation untill all references are released, and then interp traces and cleanups etc. are run. ---------------------------------------------------------------------- >Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-07-25 18:07 Message: Logged In: YES user_id=95086 Go ahead.... The previous one seems like a big waste and memory hog. Why they made it so in the first place? I would also use refcounting on the interp as you did... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1241351&group_id=130646 |