Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 72d67b75501f49137035f22442bc0d4c2c991930
Ticket: 454273ffffffffffffffffffffffffffffffffff
memory leak in regexp (tcl8.3.3)?
User & Date: hemanglavana on 2001-08-22 17:03:34
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    If the expression for regexp command is dynamically
    generated
    during runtime, then it causes a memory leak.  I am
    attaching a simple script to reproduce the problem
    (note that you will have to compile tcl with
    TCL_MEM_DEBUG flag).
    
    Here is the output of running the script on solaris2.6
    platform:
    
    
    godel:48> ./regexp.tcl
    Tcl version: 8.3.3
    ==================
       Total       Total   Current   Current   Maximum  
    Maximum
       Mallocs     Frees   Packets    Bytes    Packets   
    Bytes 
       -------     -----   -------   -------   -------  
    -------
         21494     14706      6788    348516      6874   
    413408  Initial
         21709     14890      6819    353810      6874   
    413408  count 10
         21855     15034      6821    353835      6900   
    413408  count 9
         21999     15178      6821    353835      6902   
    413408  count 8
         22143     15322      6821    353835      6902   
    413408  count 7
         22287     15466      6821    353835      6902   
    413408  count 6
         22475     15643      6832    358217      6902   
    413408  count 5
         22666     15823      6843    362639      6913   
    413408  count 4
         22854     16000      6854    367021      6924   
    413408  count 3
         23042     16177      6865    371403      6935   
    413408  count 2
         23229     16354      6875    375345      6946   
    413408  count 1
    godel:49> 
    
    You will note that the current bytes (4th column)
    remain constant for first five iterations, but
    increases for the remaining iterations. The first 5
    iterations use a constant string.
    
    This looks like a memory leak to me. We are having this
    leak in one of our tcl-based server. If I use "string
    match ..." instead of regexp, the memory leak goes
    away.
    
    Hemang.
    
    
    
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "hemanglavana"
  9. subsystem changed to: "None"
  10. title changed to: "memory leak in regexp (tcl8.3.3)?"
  11. type changed to: "Bug"