Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1e6ea7c29cf365664f7f18b9b4f76b84b5108203
Ticket: 218681ffffffffffffffffffffffffffffffffff
there is a memory leak when an empty array is created in a p
User & Date: nobody on 2000-10-26 01:04:04
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1727 Bug
    Version: 8.0p2
    SubmitDate: '1999-04-05'
    LastModified: '1999-09-16'
    Severity: MED
    Status: Released
    Submitter: pat
    ChangedBy: hobbs
    OS: All
    OSVersion: NA
    Machine: NA
    FixedDate: '1999-09-16'
    FixedInVersion: 8.2
    ClosedDate: '2000-10-25'
    
    
    Name:  Mark Falco
    email:  [email protected]
    Support:  None
    Severity:  3
    OperatingSystem:  Windows NT
    Synopsis:  there is a memory leak when an empty array is created in a procedure
    
    ReproducibleScript:
        proc abc {} {
          array set tmp {}
        }
        
        while [expr 1] {
           abc
        }
        
        #watch the memory usage, it skyrockets
        
    
    ObservedBehavior:
        in normal application this is just a slow memory leak over time
        
    
    DesiredBehavior:
        no memory leak
        
    
    Patch:
    here is a tcl script which I'm using to fix the behavior.
    
    rename array array_tcl
    
    proc array {args} {  
        if {[llength $args] == 3} {
    if {[lindex $args 0] == {set}} {
        if {[string trim [lindex $args 2]] == {}} {
    #avoid a memory leak in Tcl 8.0, when creating empty arrays
    upvar 1 [lindex $args 1] name
    if ![info exists name] {
        set name() {}
        unset name()
    }
    return
        }
    }
        }
        uplevel 1 array_tcl $args
    }
    
    8.2 shows no noticable signs of mem leak in this proc. 
    -- 09/16/1999 hobbs
    
  4. foundin changed to: "obsolete: 8.0p2"
  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:
    there is a memory leak when an empty array is created in a p
    
  11. type changed to: "Bug"