Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 734736b7188bbf0c418d23d1715c6310a7cc663e
Ticket: 218075ffffffffffffffffffffffffffffffffff
Interpreter Associated data delete proc not called when tcls
User & Date: nobody on 2000-10-26 00:52:54
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1630 Bug
    Version: 8.1b1
    SubmitDate: '1999-03-25'
    LastModified: '1999-11-30'
    Severity: MED
    Status: Closed
    Submitter: pat
    ChangedBy: hobbs
    OS: Other
    OSVersion: BSD/OS 4.0.1
    Machine: NA
    FixedDate: '2000-10-25'
    ClosedDate: '1999-11-30'
    
    
    Name:
    Robert Hare
    
    ReproducibleScript:
        Delete procedures registered using Tcl_SetAssocData are not called
        during a
        Tcl_Exit. It seems like calling Tcl_Exit would delete
        each interpreter and call all registered delete procedures and then exit
        the process.  Is there a reason it is not done this way?  It seems like
        this might
        get rid of having to register so many exit handlers.
        
        This is basically just an architectual question. --- Thanks
    
    
    
    
    
    Note, this is part RFE, part bug.  The problem is when there are shared resources between a Tcl shell and another process.  If the resource is not explicitly freed on exit, it will appear to the other process that the shell is still reserving the resource.  
    
    The concern is that finalization will be really slow if we explicitly call each free proc.  Maybe we need to have the ability to specify how to exit, or maybe the speed concerns turn out to be irrelevant.  either way we need to look into a solution.
    
    I emailed Robert again trying to clear the matter up. Here was his response:
    
    I understand that it is called during a Tcl_DeleteInterp.  My question is
    why doesn't Tcl_Exit do all the same things?  It seems strange to treat
    exiting an application differently than just deleting all interpreters and
    then exiting.
    
    The way it is done now assumes that the only reason you would want the
    routines registered with the interpreter to run on exit is to clear up
    memory. What about other resources allocated by extensions? 
    
    Here is an example:
    
    I have a extension for a database.  During the course of using the
    extension connections to the database are created.  These are done using a
    shared memory segment.  If the application exits or the interpreter is
    deleted all resources allocated (including shared memory) need to be
    freed.  Simply exiting the application can leave shared memory segments
    still in use and really mess up other processes using them.  
    
    Why choose to handle an application exit in a special way?  The more I
    think about it, the more this seems like a bug. :-)
    
    04/07/1999 11:33 - surles -
    
    --
    All in all, the user should match Tcl_CreateInterp with Tcl_DeleteInterp
    if they want AssocData handlers to be called.  Otherwise, the better
    way to handle this is to use Tcl_CreateExitHandler and
    Tcl_DeleteExitHandler to make sure cleanup is done truly on exit. 
    -- 11/30/1999 hobbs
    
    
    
  4. foundin changed to: "obsolete: 8.1b1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to:
    Interpreter Associated data delete proc not called when tcls
    
  11. type changed to: "RFE"