Skip to content
Tcl Source Code History Of Ticket 229181
Login

History Of Ticket 229181

Artifacts Associated With Ticket 229181

  1. Ticket change [97e739b577] (rid 110516) by nobody on 2001-01-17 22:18:11:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Running and embedded interpreter from C++. The following code leaks memory.
      
      ...
      while(1){
      
           char* theScript = GetScript();
           returnLength = NPstrlen( theScript );
           theObj = Tcl_NewUnicodeObj(theScript, returnLength );
      
           Tcl_EvalObjEx(theInterp, theObj , TCL_EVAL_DIRECT );
      
      }
      
      
      However, once you switch to pre-compiling the scripts into bytecode objects and using them, the leak disappears. Seems that the compile stage is not 100%.
      
      
      
    4. foundin initialized to: "obsolete: 8.4a1"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "10. Objects"
    10. title initialized to: "Compiler Leaks Memory"
    11. type initialized to: "Bug"
  2. Ticket change [a2aa4ed798] (rid 109935) by dkf on 2001-01-18 17:11:31:

    1. closedate changed to: "2001-01-18T10:11:31"
    2. closer changed to: "dkf"
    3. icomment:
      The code, as written, is failing to call Tcl_IncrRefCount prior to calling Tcl_EvalObjEx amd Tcl_DecrRefCount afterwards.  Add these calls and everything will be hunky-dory (assuming the string returned by GetScript() is cleaned up right too, of course.)
      
      while(1){ 
          char* theScript = GetScript(); 
          returnLength = NPstrlen( theScript ); 
          theObj = Tcl_NewUnicodeObj(theScript, returnLength ); 
      
          Tcl_IncrRefCount(theObj);
          Tcl_EvalObjEx(theInterp, theObj , TCL_EVAL_DIRECT ); 
          Tcl_DecrRefCount(theObj);
      } 
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"
    8. username: "dkf"