Tcl Source Code

View Ticket
Login
Ticket UUID: 571002
Title: TSD data leak on thread exit
Type: Bug Created on: 2002-06-19 07:25:10
Submitter: vasiljevic Assigned to: vasiljevic
Subsystem: 49. Threading Severity:
Priority: 7 High Last modified: 2003-02-22 16:37:54
Status: Closed Closed by: vasiljevic
Resolution: None Closed on: 2003-02-22 09:37:54
Version: obsolete: 8.4a4
Description:
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.
User Comments:
vasiljevic added on 2002-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?

hobbs added on 2003-01-28 06:55:34:
Logged In: YES 
user_id=72656

Can you post the patch for this?

hobbs added on 2003-02-19 02:44:49:
Logged In: YES 
user_id=72656

can we review and patch this for 8.4.2?

vasiljevic added on 2003-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

hobbs added on 2003-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.

vasiljevic added on 2003-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.