Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2023-03-26
11:33 • Closed ticket [3290426fff]: Valgrind reports TCL memory leak plus 9 other ch... artifact: 1bea51dfb7 user: chrstphrchvz
2011-09-14
01:01 • Closed ticket [2919042fff]: Exit reform lost valgrindability plus 6 other ch... artifact: de88468a40 user: dgp
2011-08-30
04:02 • Ticket [2919042fff]: 1 change artifact: 431deabf74 user: ferrieux
04:02 • Ticket [2919042fff]: 4 changes artifact: 5b712867a2 user: ferrieux
2011-08-29
23:42 • Open ticket [2919042fff]. artifact: cc56287c46 user: dgp
2011-08-10
00:21 • Closed ticket [2919042fff]. artifact: 8799c46525 user: ferrieux
2011-08-07
23:02 • Ticket [2919042fff]: 4 changes artifact: 37fe9a0278 user: ferrieux
23:02 • Ticket [2919042fff]: 4 changes artifact: cd2eff0e40 user: ferrieux
23:02 • Add attachment val5.patch to ticket [2919042fff] artifact: 6b459e4ee7 user: ferrieux
23:01 • Ticket [2919042fff] Exit reform lost valgrindability status still Open with ... artifact: 5dbb993b5e user: ferrieux
22:24 • Ticket [2919042fff]: 4 changes artifact: 59f8b4533b user: ferrieux
21:00 • Ticket [2919042fff]: 4 changes artifact: 59c1593c6e user: ferrieux
19:39 • Ticket [2919042fff]: 4 changes artifact: 15fe94bb62 user: msofer
2011-04-23
00:06 • Ticket [2919042fff]: 4 changes artifact: dc7040fabc user: ferrieux
2011-04-21
23:19 • Ticket [2919042fff]: 4 changes artifact: b1ac599299 user: juddgilbert
21:39 • Ticket [2919042fff]: 4 changes artifact: 8dd8c8d101 user: ferrieux
20:56 • Ticket [2919042fff]: 4 changes artifact: 20e3a6baa3 user: juddgilbert
13:52 • Ticket [2919042fff]: 4 changes artifact: 82195afaa2 user: ferrieux
13:28 • Ticket [2919042fff]: 4 changes artifact: f87a5fe246 user: ferrieux
05:39 • Ticket [2919042fff]: 4 changes artifact: 6ad392168b user: juddgilbert
05:36 • Ticket [2919042fff]: 4 changes artifact: 832c76b0a6 user: juddgilbert
03:00 • Ticket [2919042fff]: 4 changes artifact: ccb3424be3 user: ferrieux
02:59 • Ticket [2919042fff]: 4 changes artifact: 429a7adf2f user: ferrieux
02:59 • Ticket [2919042fff]: 4 changes artifact: 5a0300f009 user: ferrieux
2011-04-12
09:24 • Ticket [2919042fff]: 1 change artifact: 4e6fabb0e0 user: msofer
2011-02-13
03:43 • Ticket [2919042fff]: 1 change artifact: 33a78fb727 user: ferrieux
03:42 • Ticket [2919042fff]: 4 changes artifact: 5d86ddf460 user: ferrieux
03:41 • Ticket [2919042fff]: 4 changes artifact: 6dc7940266 user: ferrieux
03:33 • Ticket [2919042fff]: 4 changes artifact: efe062b79f user: ferrieux
03:31 • Ticket [2919042fff]: 4 changes artifact: 788e91cf9b user: ferrieux
03:31 • Ticket [2919042fff]: 4 changes artifact: 87a63e56af user: ferrieux
2009-12-22
21:25 • Ticket [2919042fff]: 4 changes artifact: a2bb75d9e3 user: ferrieux
21:24 • Ticket [2919042fff]: 4 changes artifact: e101f53420 user: ferrieux
19:05 • Ticket [2919042fff]: 4 changes artifact: 5c96841da4 user: ferrieux
18:49 • Ticket [2919042fff]: 4 changes artifact: 95902a2475 user: ferrieux
18:28 • Ticket [2919042fff]: 4 changes artifact: 6522ad23a8 user: ferrieux
18:27 • Ticket [2919042fff]: 4 changes artifact: da94bb7e0a user: ferrieux
08:06 • Ticket [2919042fff]: 4 changes artifact: 9bf031e0b2 user: ferrieux
01:06 • New ticket [2919042fff]. artifact: 0eadd8ba04 user: ferrieux

Exit reform lost valgrindability

Closed / Fixed2919042fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 15 years ago
Descriptionplain2009-12-22 01:06:25
The quick-exit reform of Bug 2001201 neglected the "valgrindability" of Tcl executables.
Indeed, it moved Tcl_Finalize out of the default Tcl_Exit path.
The attached patch corrects this by letting the TCL_FINALIZE_ON_EXIT environment variable, when set and not "0", make Tcl_Exit call Tcl_Finalize in the exact same sequence as before the reform.
It should be noted that while useful for leak hunting, this tool shouldn't be used too creatively in threaded builds. The fundamental reason behind the reform (deadlocks and crashes) is here to stay.
ferrieuxplain2009-12-22 08:06:26
File Added - 356076: val.patch
ferrieuxplain2009-12-22 18:27:20
File Deleted - 356076:
ferrieuxplain2009-12-22 18:28:05
File Added - 356116: val.patch
ferrieuxplain2009-12-22 18:49:03
Ah, valgrindability may be restored, but we still don't delete the main interp during the finalizing exit sequence. Maybe an exit handler doing DeleteInterp+Release is due ?
ferrieuxplain2009-12-22 19:05:54
Just tried that. Doesn't work, Tcl_Panic("DeleteInterpProc called with active evals");
Indeed that's a natural effect of Tcl_Eval("exit")...
What's the preferred way out of that "Muenchhausen effect" ?
ferrieuxplain2009-12-22 21:24:52
OK, proceeding anyway.
The attached 'val2' patch is a superset of the previous one; in addition, it establishes an exit handler to call FreeMainInterp, a new routine doing the final DeleteInterp+Release+SetStartupScript(NULL,NULL).
The existing TclInExit() MODULE_SCOPE-visible predicate is used to disable several panics from the running interpreter (solving the Muenchhausen effect).

With this patch, and the TCL_FINALIZE_ON_EXIT variable set, valgrind shows two interesting things (valgring --leak-check==full ./tclsh /dev/null):

   (1) a few bytes are leaked due to the active bytecode and stack frames being left over (associated with a suppressed panic complaining about them).

   (2) several big blocks of TclAllocateFreeObjects's  (2400 bytes) are leaked.

Of course, (1) is expected, pending dedicated work for cleaning up the running interp. No big deal.

However, (2) is funny in the light of the following comment in TclAllocateFreeObjects:

     * This has been noted by Purify to be a potential leak. The problem is
     * that Tcl, when not TCL_MEM_DEBUG compiled, keeps around all allocated
     * Tcl_Obj's, pointed to by tclFreeObjList, when freed instead of actually
     * freeing the memory. TclFinalizeObjects() does not ckfree() this memory,
     * but leaves it to Tcl's memory subsystem finalization to release it.
     * Purify apparently can't figure that out, and fires a false alarm.

It is funny, because there is no mystery. Purify is not at fault. It just turns out that in the default -DTCL_ALLOC=0 -UTCL_MEM_DEBUG used in unix, those blocks are simply malloc'ed with no linking or external referencing. Another proof of that is that in that case, TclFinalizeMemorySubsystem is an empty function !

Of course this merits another bugreport; in the meantime please validate the approach of the current patch.
ferrieuxplain2009-12-22 21:25:40
File Added - 356126: val2.patch
ferrieuxplain2011-02-13 03:31:05
First updating the patch to HEAD (comment reformatting in the context made it fail, grrr)
ferrieuxplain2011-02-13 03:31:47
File Deleted - 356126:
ferrieuxplain2011-02-13 03:33:14
File Added - 401497: val2.patch
ferrieuxplain2011-02-13 03:41:15
Attaching val3.patch, which additionally also forces finalization when -DPURIFY.
ferrieuxplain2011-02-13 03:42:23
File Added - 401498: val3.patch
ferrieux Ticket [2919042fff]: 1 change [History diff]2011-02-13 03:43:25
msofer Ticket [2919042fff]: 1 change [History diff]2011-04-12 09:24:36
ferrieuxplain2011-04-21 02:59:20
Updating patch to HEAD, removing old ones.
ferrieuxplain2011-04-21 02:59:36
File Deleted - 401498:
ferrieuxplain2011-04-21 03:00:13
File Added - 409373: val4.patch
juddgilbertplain2011-04-21 05:36:03
Patch val4.patch doesn't work for some reason. I'm not an expert with using these, but this is the output:

c]$ patch < val4.patch 
patching file tclBasic.c
Hunk #1 FAILED at 1353.
Hunk #2 FAILED at 1481.
Hunk #3 FAILED at 1602.
3 out of 3 hunks FAILED -- saving rejects to file tclBasic.c.rej
patching file tclEvent.c
Hunk #1 FAILED at 951.
1 out of 1 hunk FAILED -- saving rejects to file tclEvent.c.rej
patching file tclExecute.c
Hunk #1 succeeded at 55 (offset 4 lines).
Hunk #2 succeeded at 850 (offset -46 lines).
Hunk #3 succeeded at 919 (offset 4 lines).
Hunk #4 FAILED at 936.
1 out of 4 hunks FAILED -- saving rejects to file tclExecute.c.rej
patching file tclMain.c
Hunk #1 FAILED at 123.
Hunk #2 FAILED at 387.
Hunk #3 FAILED at 607.
Hunk #4 FAILED at 870.
4 out of 4 hunks FAILED -- saving rejects to file tclMain.c.rej

I started with a clean unpack of tcl8.6b1-src.tar.gz

I've going to attach the .rej files.
juddgilbertplain2011-04-21 05:39:38
strike that, it won't let me attach the files so I'll paste them in.

tlcBasic.rej

***************
*** 1353,1366 ****
      Tcl_HashTable *hTablePtr;
      ResolverScheme *resPtr, *nextResPtr;
      int i;
  
      /*
-      * Punt if there is an error in the Tcl_Release/Tcl_Preserve matchup.
       */
  
-     if (iPtr->numLevels > 0) {
  Tcl_Panic("DeleteInterpProc called with active evals");
      }
  
      /*
       * The interpreter should already be marked deleted; otherwise how did we
--- 1353,1367 ----
      Tcl_HashTable *hTablePtr;
      ResolverScheme *resPtr, *nextResPtr;
      int i;
  
      /*
+      * Punt if there is an error in the Tcl_Release/Tcl_Preserve matchup,
+  * unless we are exiting.
       */
  
+     if ((iPtr->numLevels > 0) && !TclInExit()) {
  Tcl_Panic("DeleteInterpProc called with active evals");
      }
  
      /*
       * The interpreter should already be marked deleted; otherwise how did we
***************
*** 1480,1490 ****
      /*
       * Pop the root frame pointer and finish deleting the global
       * namespace. The order is important [Bug 1658572].
       */
  
-     if (iPtr->framePtr != iPtr->rootFramePtr) {
  Tcl_Panic("DeleteInterpProc: popping rootCallFrame with other frames on top");
      }
      Tcl_PopCallFrame(interp);
      ckfree(iPtr->rootFramePtr);
      iPtr->rootFramePtr = NULL;
--- 1481,1491 ----
      /*
       * Pop the root frame pointer and finish deleting the global
       * namespace. The order is important [Bug 1658572].
       */
  
+     if ((iPtr->framePtr != iPtr->rootFramePtr) && !TclInExit()) {
  Tcl_Panic("DeleteInterpProc: popping rootCallFrame with other frames on top");
      }
      Tcl_PopCallFrame(interp);
      ckfree(iPtr->rootFramePtr);
      iPtr->rootFramePtr = NULL;
***************
*** 1601,1624 ****
       * Location stack for uplevel/eval/... scripts which were passed through
       * proc arguments. Actually we track all arguments as we do not and cannot
       * know which arguments will be used as scripts and which will not.
       */
  
-     if (iPtr->lineLAPtr->numEntries) {
  /*
   * When the interp goes away we have nothing on the stack, so there
   * are no arguments, so this table has to be empty.
   */
  
  Tcl_Panic("Argument location tracking table not empty");
      }
  
      Tcl_DeleteHashTable(iPtr->lineLAPtr);
-     ckfree(iPtr->lineLAPtr);
      iPtr->lineLAPtr = NULL;
  
-     if (iPtr->lineLABCPtr->numEntries) {
  /*
   * When the interp goes away we have nothing on the stack, so there
   * are no arguments, so this table has to be empty.
   */
  
--- 1602,1625 ----
       * Location stack for uplevel/eval/... scripts which were passed through
       * proc arguments. Actually we track all arguments as we do not and cannot
       * know which arguments will be used as scripts and which will not.
       */
  
+     if (iPtr->lineLAPtr->numEntries && !TclInExit()) {
  /*
   * When the interp goes away we have nothing on the stack, so there
   * are no arguments, so this table has to be empty.
   */
  
  Tcl_Panic("Argument location tracking table not empty");
      }
  
      Tcl_DeleteHashTable(iPtr->lineLAPtr);
+     ckfree((char *) iPtr->lineLAPtr);
      iPtr->lineLAPtr = NULL;
  
+     if (iPtr->lineLABCPtr->numEntries && !TclInExit()) {
  /*
   * When the interp goes away we have nothing on the stack, so there
   * are no arguments, so this table has to be empty.
   */
  

tclEvent.rej

***************
*** 951,981 ****
   */
  
  currentAppExitPtr(INT2PTR(status));
  Tcl_Panic("AppExitProc returned unexpectedly");
      } else {
- /*
-  * Use default handling.
-  */
- 
- InvokeExitHandlers();
- 
- /*
-  * Ensure the thread-specific data is initialised as it is used in
-  * Tcl_FinalizeThread()
-  */
- 
- (void) TCL_TSD_INIT(&dataKey);
- 
- /*
-  * Now finalize the calling thread only (others are not safely
-  * reachable).  Among other things, this triggers a flush of the
-  * Tcl_Channels that may have data enqueued.
-  */
- 
- Tcl_FinalizeThread();
- 
  TclpExit(status);
  Tcl_Panic("OS exit failed!");
      }
  }
  
--- 951,1004 ----
   */
  
  currentAppExitPtr(INT2PTR(status));
  Tcl_Panic("AppExitProc returned unexpectedly");
      } else {
+ const char *fin;
+ Tcl_DString ds;
+ int finalize = 0;
+ 
+ fin = TclGetEnv("TCL_FINALIZE_ON_EXIT", &ds);
+ finalize = ((fin != NULL) && strcmp(fin, "0"));
+ if (fin != NULL) {
+ Tcl_DStringFree(&ds);
+ }
+ 
+ #ifdef PURIFY
+ finalize = 1;
+ #endif
+ if (finalize) {
+ 
+     /*
+      * Thorough finalization for Valgrind et al.
+      */
+ 
+     Tcl_Finalize();
+ 
+ } else {
+ 
+     /*
+      * Fast and deterministic exit (default behavior)
+      */
+     
+     InvokeExitHandlers();
+     
+     /*
+      * Ensure the thread-specific data is initialised as it is used in
+      * Tcl_FinalizeThread()
+      */
+     
+     (void) TCL_TSD_INIT(&dataKey);
+     
+     /*
+      * Now finalize the calling thread only (others are not safely
+      * reachable).  Among other things, this triggers a flush of the
+      * Tcl_Channels that may have data enqueued.
+      */
+     
+     Tcl_FinalizeThread();
+ }
  TclpExit(status);
  Tcl_Panic("OS exit failed!");
      }
  }
  
tclExecute.rej

***************
*** 932,945 ****
  DeleteExecStack(tmpPtr);
      }
  
      TclDecrRefCount(eePtr->constants[0]);
      TclDecrRefCount(eePtr->constants[1]);
-     if (eePtr->callbackPtr) {
- Tcl_Panic("Deleting execEnv with pending NRE callbacks!");
      }
-     if (eePtr->corPtr) {
  Tcl_Panic("Deleting execEnv with existing coroutine");
      }
      ckfree(eePtr);
  }
  
--- 936,949 ----
  DeleteExecStack(tmpPtr);
      }
  
      TclDecrRefCount(eePtr->constants[0]);
      TclDecrRefCount(eePtr->constants[1]);
+     if (eePtr->callbackPtr && !cachedInExit) {
+ Tcl_Panic("Deleting execEnv with pending TEOV callbacks!");
      }
+     if (eePtr->corPtr && !cachedInExit) {
  Tcl_Panic("Deleting execEnv with existing coroutine");
      }
      ckfree(eePtr);
  }
  

tclMain.rej


***************
*** 123,132 ****
   */
  
  MODULE_SCOPE Tcl_MainLoopProc *TclGetMainLoop(void);
  static voidPrompt(Tcl_Interp *interp, InteractiveState *isPtr);
  static voidStdinProc(ClientData clientData, int mask);
  
  #ifndef TCL_ASCII_MAIN
  static Tcl_ThreadDataKey dataKey;
  /*
   *----------------------------------------------------------------------
--- 123,133 ----
   */
  
  MODULE_SCOPE Tcl_MainLoopProc *TclGetMainLoop(void);
  static voidPrompt(Tcl_Interp *interp, InteractiveState *isPtr);
  static voidStdinProc(ClientData clientData, int mask);
+ static void     FreeMainInterp(ClientData clientData);
  
  #ifndef TCL_ASCII_MAIN
  static Tcl_ThreadDataKey dataKey;
  /*
   *----------------------------------------------------------------------
***************
*** 386,395 ****
      }
      if (Tcl_LimitExceeded(interp)) {
  goto done;
      }
  
      /*
       * Invoke the script specified on the command line, if any. Must fetch it
       * again, as the appInitProc might have reset it.
       */
  
--- 387,402 ----
      }
      if (Tcl_LimitExceeded(interp)) {
  goto done;
      }
  
+ /*
+  * Arrange for final deletion of the main interp
+  */
+ // ARGH Munchhausen effect 
+ Tcl_CreateExitHandler(FreeMainInterp, (ClientData)interp);
+ 
      /*
       * Invoke the script specified on the command line, if any. Must fetch it
       * again, as the appInitProc might have reset it.
       */
  
***************
*** 600,629 ****
  
      Tcl_IncrRefCount(cmd);
      Tcl_EvalObjEx(interp, cmd, TCL_EVAL_GLOBAL);
      Tcl_DecrRefCount(cmd);
  }
- 
  /*
   * If Tcl_EvalObjEx returns, trying to eval [exit], something unusual
   * is happening. Maybe interp has been deleted; maybe [exit] was
   * redefined, maybe we've blown up because of an exceeded limit. We
   * still want to cleanup and exit.
   */
- 
- if (!Tcl_InterpDeleted(interp)) {
-     Tcl_DeleteInterp(interp);
- }
-     }
-     Tcl_SetStartupScript(NULL, NULL);
- 
-     /*
-      * If we get here, the master interp has been deleted. Allow its
-      * destruction with the last matching Tcl_Release.
-      */
- 
-     Tcl_Release(interp);
      Tcl_Exit(exitCode);
  }
  
  #ifndef UNICODE
  void
--- 607,623 ----
  
      Tcl_IncrRefCount(cmd);
      Tcl_EvalObjEx(interp, cmd, TCL_EVAL_GLOBAL);
      Tcl_DecrRefCount(cmd);
  }
+ }
  /*
   * If Tcl_EvalObjEx returns, trying to eval [exit], something unusual
   * is happening. Maybe interp has been deleted; maybe [exit] was
   * redefined, maybe we've blown up because of an exceeded limit. We
   * still want to cleanup and exit.
   */
      Tcl_Exit(exitCode);
  }
  
  #ifndef UNICODE
  void
***************
*** 876,889 ****
      chan = Tcl_GetStdChannel(TCL_STDOUT);
      if (chan != NULL) {
  Tcl_Flush(chan);
      }
      isPtr->prompt = PROMPT_NONE;
  }
  
  /*
   * Local Variables:
   * mode: c
   * c-basic-offset: 4
   * fill-column: 78
   * End:
   */
--- 870,909 ----
      chan = Tcl_GetStdChannel(TCL_STDOUT);
      if (chan != NULL) {
  Tcl_Flush(chan);
      }
      isPtr->prompt = PROMPT_NONE;
+ }
+ 
+ /*
+  *----------------------------------------------------------------------
+  *
+  * FreeMainInterp --
+  *
+  *Exit handler used to cleanup the main interpreter and ancillary startup
+  *script storage at exit.
+  *
+  *----------------------------------------------------------------------
+  */
+ 
+ static void
+ FreeMainInterp(
+     ClientData clientData)
+ {
+ Tcl_Interp *interp = (Tcl_Interp *) clientData;
+ 
+ //if (TclInExit()) return;
+ 
+ if (!Tcl_InterpDeleted(interp)) {
+     Tcl_DeleteInterp(interp);
+ }
+     Tcl_SetStartupScript(NULL, NULL);
+     Tcl_Release(interp);
  }
  
  /*
   * Local Variables:
   * mode: c
   * c-basic-offset: 4
   * fill-column: 78
   * End:
   */
ferrieuxplain2011-04-21 13:28:13
Val4.pach is against 8.6 HEAD. Please pull it  (possibly as a zip, not necessarily as fossil clone) from core.tcl.tk.
ferrieuxplain2011-04-21 13:52:59
Now fossil even has tarballs, yay :)

For example, today's HEAD:

http://core.tcl.tk/tcl/tarball/Tcl%20Source%20Code-2e77c2b14bdfb544.tar.gz?uuid=2e77c2b14bdfb54416ad95991aad51a1a51a38ba
juddgilbertplain2011-04-21 20:56:15
I'm really sorry if I'm doing something dumb, but val4.patch successfully patched tclBasic.c, tclEvent.c, tclExecute.c, and then failed on tclMain.c. All using the head tarball linked.

Sorry to be such a pain :( I do appreciate your help.

tclMain.c.ref

***************
*** 876,889 ****
      chan = Tcl_GetStdChannel(TCL_STDOUT);
      if (chan != NULL) {
  Tcl_Flush(chan);
      }
      isPtr->prompt = PROMPT_NONE;
  }
  ^L
  /*
   * Local Variables:
   * mode: c
   * c-basic-offset: 4
   * fill-column: 78
   * End:
   */
--- 870,909 ----
      chan = Tcl_GetStdChannel(TCL_STDOUT);
      if (chan != NULL) {
  Tcl_Flush(chan);
      }
      isPtr->prompt = PROMPT_NONE;
+ }
+ ^L
+ /*
+  *----------------------------------------------------------------------
+  *
+  * FreeMainInterp --
+  *
+  *Exit handler used to cleanup the main interpreter and ancillary startup
+  *script storage at exit.
+  *
+  *----------------------------------------------------------------------
+  */
+ 
+ static void
+ FreeMainInterp(
+     ClientData clientData)
+ {
+ Tcl_Interp *interp = (Tcl_Interp *) clientData;
+ 
+ //if (TclInExit()) return;
+ 
+ if (!Tcl_InterpDeleted(interp)) {
+     Tcl_DeleteInterp(interp);
+ }
+     Tcl_SetStartupScript(NULL, NULL);
+     Tcl_Release(interp);
  }
  ^L
  /*
   * Local Variables:
   * mode: c
   * c-basic-offset: 4
   * fill-column: 78
   * End:
   */
ferrieuxplain2011-04-21 21:39:53
Well, just tried the same on a different system, no problems. Please seek local help on how to use 'patch'.


lat6466.rd.francetelecom.fr:tunzip.12712:{2}> cd Tcl_Source_Code-2e77c2b14bdfb544/
lat6466.rd.francetelecom.fr:Tcl_Source_Code-2e77c2b14bdfb544:{3}> ls
ChangeLog       ChangeLog.2002  ChangeLog.2007  compat/   libtommath/    tests/
ChangeLog.1999  ChangeLog.2003  ChangeLog.2008  doc/      license.terms  tools/
ChangeLog.2000  ChangeLog.2004  README          generic/  macosx/        unix/
ChangeLog.2001  ChangeLog.2005  changes         library/  pkgs/          win/
lat6466.rd.francetelecom.fr:Tcl_Source_Code-2e77c2b14bdfb544:{4}> patch -p0 < /tmp/val4.patch 
patching file generic/tclBasic.c
patching file generic/tclEvent.c
patching file generic/tclExecute.c
patching file generic/tclMain.c
juddgilbertplain2011-04-21 23:19:10
Finally success! I'm not sure why the patch file val4.patch didn't work on tclMain.c, but I manually patched it by editing the file using the appropriate section from val4.patch and that worked. I no longer have 14400 bytes left on the stack!

Thanks again for your help. 

Now it is going to bug me to no end why that patch file doesn't work for me on just that one file.
ferrieuxplain2011-04-23 00:06:04
Will commit after cleaning up a strange single quote I observe in the testsuite.
msoferplain2011-08-07 19:39:50
Why wasn't this patch committed?
ferrieuxplain2011-08-07 21:00:40
Cause of a strange side-effect on the test suite (a single " character) I have not found the time to chase...
ferrieuxplain2011-08-07 22:24:40
'k, that offending *single* quote is \x27 produced by chan-4.6 as an output eofchar.
So I guess the patch unwillingly revives some end-of-channel-life code. Hm.
ferrieuxplain2011-08-07 23:01:23
Found it. That side-effect was itself a consequence of the patch forcing a Tcl_DeleteInterp of the main interp even when full finalization was not requested. Attached corrected patch. Committable ?
ferrieuxplain2011-08-07 23:02:18
File Added - 420499: val5.patch
ferrieuxplain2011-08-07 23:02:29
File Deleted - 409373:
ferrieuxplain2011-08-10 00:21:07
Committed to HEAD.
dgpplain2011-08-29 23:42:13
It seems that the [testthread] command has similar
issues.  When [testthread exit] runs, it calls Tcl_ExitThread()
which prevents unwinding after that point, so that the interp
in which [testthread exit] is eval'd doesn't get all its Tcl_Release()
calls, and leaks.

Looking for the right way to adapt the solution here to apply there
as well.  See anything obvious?
ferrieuxplain2011-08-30 04:02:11
Yes, the work in progress you've just committed seems the way to go.
Still, two remarks:
(1) maybe you want a cachedInThreadExit alongside cachedInExit since the tsd lookup might be costly
(2) once you've brought thread exit in line with process exit, I guess there will remain the leaks in 3392735, which are the one that the panics were here to highlight.
ferrieux Ticket [2919042fff]: 1 change [History diff]2011-08-30 04:02:39
dgpplain2011-09-14 01:01:29
allow_comments - 1
Log in (anonymous is fine) to add a comment.

Attachments: