Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2002-02-13
02:58 • Closed ticket [516435ffff]: Memory problem in Tcl8.3.4? plus 8 other changes artifact: 9e2fbf2dc7 user: msofer
02:44 • Pending ticket [516435ffff]. artifact: 0a22798305 user: hobbs
2002-02-12
14:36 • New ticket [516435ffff]. artifact: 59bfb3f3ee user: nobody

Memory problem in Tcl8.3.4?

Closed / Invalid516435ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2002-02-12 14:36:43
If I compile and run the following program on a 2.4
linux machine (gcc 2.95.3) with tcl8.3.4 which I have
compiled from source, the amount of memory used
increases very rapidly:

#include <stdio.h>
#include <stdlib.h>
#include <tcl.h>

int main() {
  Tcl_Interp *interp;
  int i;
  char task[] = "for {set i 0} {$i < 100} {incr i} {set
a($i) $i}";

  for(i = 0; i < 100000; i++) {
    interp = Tcl_CreateInterp();
    Tcl_Init(interp);
    Tcl_Eval(interp, task);
    Tcl_Finalize();
    Tcl_DeleteInterp(interp);
  }

  return 0;
}
 

I hope that this is a satisfactory report,

regards,

Graeme
hobbsplain2002-02-13 02:44:48
Logged In: YES 
user_id=72656

Please see the newsgroup comments that note that this is 
not a correct program.  If the corrected version still 
exhibits problems, please tell us about how much each 
instance seems to leak.
msoferplain2002-02-13 02:58:17
Logged In: YES 
user_id=148712

I'm closing this ticket: Graeme Winter (author of the bug
report) informed me that the leak is gone if Tcl_Finalize is
called after deleting the interpreter.
Log in (anonymous is fine) to add a comment.