Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c4427c17db3cfa063b1f2f991b5cb5fad4cc4c36
Ticket: 3390699fffffffffffffffffffffffffffffffff
socket_*-13.1 leaks
User & Date: ferrieux on 2011-08-13 23:11:03
Changes

  1. icomment:
    Anyway, single-stepping through the thread's end shows that testthread::exit does *not* do the same as falling thru.
    Notably, the Tcl_DeleteInterp() is omitted, which would account for the leak (the Interp object itself !).
    However, when trying to give back symmetry (with the attached patch), on encounters a secondary problem. In DeleteInterpProc, the test
    
        /*
         * 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");
        }
    
    panics in that case. Of course numLevels is >0 (it is 2) because "exit" is called from within an event handler... as is most often the case.
    
    I suspect that is the reason why the original author (stanton, <=1999) removed DeleteInterp from the sequence, but  that's pulling it under the rug.
    
    Still digging to understand how the equivalent situation is handled in [exit].
    
    Q1: why such a stringent test (panicking if it fails) ?
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"