Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 32f66d7f6b259380cb199cd9c00537052b799ca1
Ticket: 2724403fffffffffffffffffffffffffffffffff
Delete NS with active coro -> leak
User & Date: msofer on 2009-05-02 21:43:38
Changes

  1. icomment:
    Confirmed leak on namespace deletion: run the following script and monitor the mem growth under top!
    
     while 1 {
         set ns ::y[incr q]
         namespace eval $ns {}
         proc ${ns}::start {} {yield; puts hello}
         coroutine ${ns}::run ${ns}::start
         namespace delete $ns
         after 1
     }
    
    Note that both [run] and [start] need to be in the same namespace for the bug to occur: 
      * [start] has a CallFrame that keeps $ns active: $ns is set to be torn down when [start] returns
      * [start] will be forced to return when the coro is wound down, which will be triggered by [run]'s deletion
      * [run] will be deleted when $ns is torn down
    
    That is: $ns will be torn down when [run] is deleted, and [run] will be deleted when $ns is torn down: a sort of deadlock.
    
    
  2. login: "msofer"
  3. mimetype: "text/plain"
  4. username: "msofer"