tcl-websh-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronnie Brunner <>
Subject memory leaks fixed
Date Thu, 25 Jul 2002 14:47:36 GMT
I just closed another leak and now I can't produce any unexpected
memory consumption in mod_websh anymore.

Please let me know if you still think it leaks anywhere. Note that
running multiple (and different) requests in the same interp causes
websh to grow initially, until all the code is sourced and run
once. (You can definitly still write an application that leaks: just
add something like

	  global foo
	  if {![info exists foo]} {
	      set foo "a bar"
	  } else {
	      append foo " and another bar"

to it and you will logically eat memory until tomorrow. For that
reason it might be cool to set a limit on the maximum requests in any
interpreter. I'll check in the webshconf.tcl with that limit set to
a 1000 requests. Hope that's ok.

Summary of fixed leaks

- requestFillRequestValues: a New Tcl_Obj was created, but never used
  (It seems that Tcl doesn't clean that up, if there is never a
  Tcl_DecrRefCount, which means you have to call Tcl_IncrRefCount to
  be able to roperly call Tcl_DecrRefCount and have the object cleaned
  up. -> just commented the call)

- cfg_Init and request_Init both called Tcl_CreateThreadExitHandler,
  which results in a leak when interpreter are created and deleted.
  (I don't know, why these handlers are added in the first place -> I
  commented them out, but added a fixme, because I can't reach Simon,
  who is on vacation). IMHO go for the release like this is ok.

- web::putx leaked big time, because the paresed strings (DStrings)
  were never freed (strange that no one noticed this earlier)

Ronnie Brunner                     
Netcetera AG, 8040 Zuerich     phone +41 1 247 79 79 fax +41 1 247 70 75

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message