Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: af970e281116c0cd9ba22d28ee44918a15aa7a68
Ticket: 229969ffffffffffffffffffffffffffffffffff
Memory Leak TCL 8.3.0 in TclAlloc
User & Date: nobody on 2001-01-24 21:36:26
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    I am creating a interpreter in a C++ program using the call
    Tcl_CreateInterp  after that I use Tcl_SetVar to define variable values and then call Tcl_EvalFile to evaluate a script . The code that is running the interpreter is running in its own thread and I use Tcl_GetVar and Tcl_SetVar to communicate with the interpreter from another thread.  All works great but when I delete the interpeter with Tcl_DeleteInterp I find a memory leak of about 10 k due to Tcl_Alloc (using Solaris Workshop Leak Check).  According to My latest TCL/TK book (Welch) calling Tcl_DeleteInterp only marks the interpreter as deleteable and only deletes if Tcl_Release is called as Many Times as Tcl_Preserve.  I modified the Tcl Code to emit a message to stdout when Tcl_Preserve is called. At no time is the message seen unless I specifically call it in my C++ program. I have called Tcl_UnsetVar on all my global variable prior to deletion and it has no effect.  All my variables are set with the option TCL_GLOBAL_ONLY flag. 
    1 ) if the call Tcl_DeleteInterp marks the interpreter as deletable and then returns how is the deletion code ever going to run ?
    2) If Tcl_DeleteInterp does indeed try to remove all memory
    before returning then you have a memory leak problem.
    3) If you don't think you have a memory leak problem then given the information above how do I free the variables I Set and Get.  What concerns me is that Tcl reassigns the memory that a variable possesses every time it is set. Do I have to free that memory first before setting (i.e 
    char * data = Tcl_GetVar(interp,"data",TCL_GLOBAL_ONLY);
    Tcl_Free(data);
    ?
    
  4. foundin changed to: "obsolete: 8.3"
  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: "95. contrib ports"
  10. title changed to: "Memory Leak TCL 8.3.0 in TclAlloc"
  11. type changed to: "Bug"