Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7700f8e260fcd50bb5a3720ddfc70b0fc450c4a3
Ticket: 733126ffffffffffffffffffffffffffffffffff
Memory leak while creating and deleting interpreters
User & Date: kdina2001 on 2003-05-06 22:53:47
Changes

  1. icomment:
    Logged In: YES 
    user_id=772890
    
    I tested with the latest version as well. That is 8.3.5. The issue seems to be present in 
    this version as well. I was able to fix this by doing something as follows. But am not 
    sure if that affects anything else. Can you please let me know if there is a better fix
    available ?
    
    File : unix/tclUnixChan.c :
    ==================
    static int  FileCloseProc(instanceData, interp)
        ClientData instanceData;/* File state. */
        Tcl_Interp *interp;/* For error reporting - unused. */
    {
        FileState *fsPtr = (FileState *) instanceData;
        FileState **nextPtrPtr;
        int errorCode = 0;
        ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
    
        [ -- snip -- ]
    
        for (nextPtrPtr = &(tsdPtr->firstFilePtr); (*nextPtrPtr) != NULL;
     nextPtrPtr = &((*nextPtrPtr)->nextPtr)) {
    if ((*nextPtrPtr) == fsPtr) {
        (*nextPtrPtr) = fsPtr->nextPtr;
        break;
    }
        }
        ckfree((char *) fsPtr);
    
        /*Added the following to free the allocation made for tsd*/
        if(tsdPtr->firstFilePtr == NULL){
           /* List is empty, free the head */
           ckfree( tsdPtr );
        }
    
        return errorCode;
    }
    
    
    
  2. login: "kdina2001"
  3. mimetype: "text/plain"
  4. username: "kdina2001"