Skip to content
Tcl Source Code View Ticket
Login

View Ticket

TSD data leak on thread exit

Closed571002ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-06-19 07:25:10
For threads created with Tcl API, TSD memory blocks are
not properly freed on thread exit. This happens in cases
where new thread does not register any exit callbacks
and/or does not create any Tcl interpreters.

The problematic spot is Tcl_FinalizeThread function in
generic/tclEvent.c file. The TclFinalizeThreadData() call
should be *unconditionally* executed at the end of the
finalization process.
vasiljevicplain2002-08-24 01:07:42
Logged In: YES 
user_id=95086

I have corrected this in my local cvs copy. 
Should I submit it now?
hobbsplain2003-01-28 06:55:34
Logged In: YES 
user_id=72656

Can you post the patch for this?
hobbsplain2003-02-19 02:44:49
Logged In: YES 
user_id=72656

can we review and patch this for 8.4.2?
vasiljevicplain2003-02-19 19:31:00
Logged In: YES 
user_id=95086

Absolutely, now that I'm back again :)  
 
It is rather trivial. In the Tcl_FinalizeThread at the bottom:  
  
/*  
 * Blow away all thread local storage blocks.  
 */  
  
TclFinalizeThreadData();  
    }  
}  
  
should be changed to: 
  
     } 
 
    /*  
     * Blow away all thread local storage blocks.  
     */  
  
    TclFinalizeThreadData();  
} 
 
That's all. If you like, I can commit this into CVS. 
Cheers, 
Zoran
hobbsplain2003-02-20 09:41:48
Logged In: YES 
user_id=72656

Please verify with threaded builds on at least Windows and 
Linux, and whatever else you might have available, before 
commiting.
vasiljevicplain2003-02-22 16:37:54
Logged In: YES 
user_id=95086

Fixed starting from 1.28 version of tclEvent.c. 
Checked on Linux, Solaris, Win.
Log in (anonymous is fine) to add a comment.