Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-19
03:37 • Ticket [219066ffff] leak related to SOURCE command status still Closed with ... artifact: d7203b9e21 user: dgp
2000-10-26
08:34 • Closed ticket [219066ffff]. artifact: 279c7ada6b user: welch
01:10 • New ticket [219066ffff]. artifact: 1ace1b7c8f user: nobody

leak related to SOURCE command

Closed / Invalid219066ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:10:06
OriginalBugID: 4552 Bug
Version: 8.2
SubmitDate: '2000-03-24'
LastModified: '2000-03-27'
Severity: LOW
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: Windows NT
FixedDate: '2000-03-27'
FixedInVersion: 8.3.1
ClosedDate: '2000-10-25'


Name:
Kent Bloomstrand

ReproducibleScript:
The leak is not limited to only the TclPro library. I just ran 
another test this morning against both the "tcl82.dll" that 
ships with SS 5.0 and that of Tcl 8.2.3 and here is what I found:

Beside the TclPro 1.3 tbcload leak problem, there is a definite leak 
in the base "source" command not getting properly cleaned up after 
TCL_DeleteInterp() is called. This happens with either the "tcl82.dll" 
that ships with StoryServer 5.0 (w/ 5.0.1 QA-8 patch) or with the 
Tcl 8.2.3 "tcl82.dll". I don't think we can allow leaks like this to 
occur in our products. 

In a simple test case, I run the program below to simulate a total 
of 40000 calls to repeatedly "source" the same non-compiled TCL file 
(with 600 simple procedures inside) and the total leak was about 10MB 
on my NT box. 

How to reproduce: 
Compile and run the following C program (similar to the one from Step 3). 
The file "d:/temp/plain.tcl" (cmd_2 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[]) 
{ 
    int i, j, status; 
    char *cmd_2 = "source {d:/temp/plain.tcl}"; 
    Tcl_Interp *interp; 

    interp = Tcl_CreateInterp(); 
    for (i = 0 ; i < 400 ; i++) { 
        printf("%d...", i); 
        for (j = 0 ; j < 100 ; j++) { 
            printf("."); 
            status = Tcl_GlobalEval(interp, cmd_2); 
            if (status != TCL_OK) { 
                printf("Source failed\n"); 
                return 1; 
            } 
        } 
        printf("\n"); 
    } 
    Tcl_DeleteInterp(interp); 

    printf("Hit RETURN when done..."); 
    getchar(); 
    return 0; 
}

ObservedBehavior:
it leaks memory

DesiredBehavior:
it doesn't leak



This turned out to be a "bug" in the provided script which never
cleared the namespace export array (given the optional -clear
argument).  8.3.1 has a fix to further improve this by checking
for duplicates before adding to the export array. 
-- 03/27/2000 hobbs
welch Closed ticket [219066ffff]. [History diff]2000-10-26 08:34:07
dgp Ticket [219066ffff]: 4 changes [History diff]2001-04-19 03:37:44
Log in (anonymous is fine) to add a comment.