summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--generic/tclEvent.c25
2 files changed, 32 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 60560f9..98d54b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2004-07-15 Kevin Kenny <kennykb@acm.org>
+ * generic/tclEvent.c (Tcl_Finalize): stuffed memory leak
+ incurred by re-initializing of TSD slots after the last call to
+ TclFinalizeThreadData (done from within Tcl_FinalizeThread()).
+ We basically just repeat the TclFinalizeThreadData() once more
+ before tearing down TSD keys in TclFinalizeSynchronization().
+ There should be more elaborate mechanism in place for handling
+ such issues, based on thread cleanup handlers registered on the
+ OS level. Such change requires much more work and would also
+ require TIP because some visible parts of Tcl API would have to
+ be modified. In the meantime, this will do.
+
+2004-07-15 Kevin Kenny <kennykb@acm.org>
+
* generic/tclLiteral.c (TclReleaseLiteral): Removed unused
variable 'codePtr' to silence a message from VC++.
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 2abd239..b169196 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEvent.c,v 1.42 2004/07/15 10:00:45 vasiljevic Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.43 2004/07/15 20:04:38 vasiljevic Exp $
*/
#include "tclInt.h"
@@ -933,10 +933,23 @@ Tcl_Finalize()
Tcl_SetPanicProc(NULL);
/*
+ * Repeat finalization of the thread local storage once more.
+ * Although this step is already done by the Tcl_FinalizeThread
+ * call above, series of events happening afterwards may
+ * re-initialize TSD slots. Those need to be finalized again,
+ * otherwise we're leaking memory chunks.
+ * Very important to note is that things happening afterwards
+ * should not reference anything which may re-initialize TSD's.
+ * This includes freeing Tcl_Objs's, among other things.
+ *
+ * This fixes the Tcl Bug #990552.
+ */
+ TclFinalizeThreadData();
+
+ /*
* Free synchronization objects. There really should only be one
* thread alive at this moment.
*/
-
TclFinalizeSynchronization();
/*
@@ -1021,17 +1034,17 @@ Tcl_FinalizeThread()
TclFinalizeAsync();
}
- /*
- * Blow away all thread local storage blocks.
+ /*
+ * Blow away all thread local storage blocks.
*
* Note that Tcl API allows creation of threads which do not use any
* Tcl interp or other Tcl subsytems. Those threads might, however,
* use thread local storage, so we must unconditionally finalize it.
*
* Fix [Bug #571002]
- */
+ */
- TclFinalizeThreadData();
+ TclFinalizeThreadData();
}
/*