Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 791b39cdb459ceb9bcdddbf7cef190d78dd173d6
Ticket: 218385ffffffffffffffffffffffffffffffffff
procs created by TCL_CreateInterp() leaks memory
User & Date: nobody on 2000-10-26 00:56:57
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 4553 Bug
    Version: 8.2
    SubmitDate: '2000-03-24'
    LastModified: '2000-03-27'
    Severity: SER
    Status: Closed
    Submitter: techsupp
    ChangedBy: hobbs
    RelatedBugIDs: 4552 4503
    OS: Windows NT
    FixedDate: '2000-10-25'
    ClosedDate: '2000-03-27'
    
    
    Name:
    Kent Bloomstrand
    
    ReproducibleScript:
    It seems redefining the same procs (non-compiled) within a single 
    TCL interp created by TCL_CreateInterp() will also cause memory 
    leak (per Mark Scheevel's suggestion). 
    
    How to reproduce: 
    
    Compile and run the following C program (similar to the one from Step 3). 
    The file "d:/temp/plain.tcl" ("*file" in the following program) is the 
    same simple TCL file from Step 1 before with 600 simple procedures 
    such as 'proc ::ns::proc_a {} {return 1}': 
    
    int main(int argc, char* argv[]) 
    { 
        // code to re-eval the same set of non-compiled TCL procs 250,000 times 
        int i, j, status; 
        char tmp[32766]; 
        char *file = "d:/temp/plain.tcl"; 
        char cmd_string[32766]; 
        FILE *fp; 
        Tcl_Interp *interp; 
    
        if (NULL != (fp = fopen(file, "r"))) { 
            strcpy(cmd_string, "namespace eval :: {\n"); 
            while (! feof(fp)) { 
                (void) fgets(tmp, 2048, fp); 
                strcat(cmd_string, tmp); 
            } 
            strcat(cmd_string, "}\n"); 
        } 
        fclose(fp); 
    
        interp = Tcl_CreateInterp(); 
        for (i = 0 ; i < 10000 ; i++) { 
            printf("%d...", i); 
            for (j = 0 ; j < 100 ; j++) { 
                printf("."); 
                status = Tcl_GlobalEval(interp, cmd_string); 
                if (status != TCL_OK) { 
                    printf("namespace eval failed\n"); 
                    return 1; 
                } 
            } 
            printf("\n"); 
        } 
        Tcl_DeleteInterp(interp); 
    
        printf("Hit RETURN when done..."); 
        getchar(); 
        return 0; 
    }
    
    ObservedBehavior:
    it leaks
    
    DesiredBehavior:
    no leak
    
    
    
    This particular case is not reproducable, but may be related to
    4552 (use of 'namespace export cmd1' causes monotonic memory
    growth, but *not* a leak), or 4503, which points out that tbcload
    has a leak in repeated sourcing of the same file. 
    -- 03/27/2000 hobbs
    
  4. foundin changed to: "obsolete: 8.2"
  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: "procs created by TCL_CreateInterp() leaks memory"
  11. type changed to: "Bug"