Skip to content
Tcl Source Code History Of Ticket 218066
Login

History Of Ticket 218066

Artifacts Associated With Ticket 218066

  1. Ticket change [1a93e6493e] (rid 123004) by nobody on 2000-10-26 00:52:48:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 1557 RFE
      Version: 8.0.4
      SubmitDate: '1999-03-19'
      LastModified: '2000-04-03'
      Severity: LOW
      Status: Closed
      Submitter: pat
      ChangedBy: hobbs
      OS: Other
      OSVersion: NT4.0, IRIX 6.2, IRIX 6.5, Mac OS8.1 & OS8.5
      Machine: NA
      FixedDate: '2000-10-25'
      ClosedDate: '2000-04-03'
      
      
      Name:
      William Chen
      
      DesiredBehavior:
          It appears that the garbage collection properties of Tcl+Tk does not
          extend to the "infinitely Recursive" calls.  Placing the recursive
          function call in an after script script is still recursion.  Memory has
          to be released by unsetting unused local variables.  Unless this local
          memory is released, it will never be released while the Wish Shell is
          running.
          
          I'm providing samples of two methods used to create event handlers.  The
          after command allows the separate polling event handlers to execute in
          different threads.  It is also more elegant than putting them all into
          one big while loop since multiple events can be polled at different
          intervals.
          
          Unset is only briefly mentioned on your web page.  Ousterhout's
          _Tcl_and_the_Tk_ToolKit_ and Welch's
          _Practical_Programming_in_Tcl_and_Tk_ books dedicate 1 small paragraph
          each to unset.
          
          ______________________________
          Function1 {} {
           global Function1ID
           Fucntion2
           set Function1ID [after _time_ Function1]
          }
          
          Function2 {} {
            global saveString
            local var1 var2 string1
            set var1 Somevalue
            set var2 Somevalue
            set string1 SomeLargevalueReturnedFromFunctionCall
          
            set saveString $string1  ;# copy local value to global
          
          #Local variables must be unset to release memory for recursive call
          #Normally Garbage Collection will take care of this.
          #We were not doing this before and it was causing memory leaks
            unset var1
            unset var2
            unset string1
          }
          
          KillFunciton1 {} {
             after cancel $Function1ID
          }
          
          _________________________________
          
          TestFunction {} {
            global TestFuntionID
            global saveString
            local var1 var2 sting1
            set var1 SomeValue
            set var2 SomeValue
            set string1 SomeLargeValueRetunedFromFunctionCall
          
            set saveString $string1 ;# copy local value to global
          
          #Local variables must be unset to release memory for recursive call
            unset var1
            unset var2
            unset string1
          
          #Make a recursive call to the function after a set time.
            set TestFunctionID  after _time_ TestFunction
          }
          
          KillTestFunction {} {
            after cancel $TestFunctionID
          }
          
          After calling KillTestFunction or KillFunction1, TestFuntion and
          Funtion1 does not know that the recursive call has been interrupted.
          The memory created withing these functions does not get released without
          an explicit call to unset them.
          
      
      
      
      
      "local" isn't a Tcl core command, and it may not be coded correctly
      to release the objects.  Otherwise, this doesn't seem like it should
      be a problem in the core (Tcl tests Pure). 
      -- 04/03/2000 hobbs
      
    4. foundin initialized to: "obsolete: 8.0.4"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "69. Other"
    10. title initialized to:
      The necessary use of the 'unset' in a recursive call is not 
      
    11. type initialized to: "Bug"
  2. Ticket change [64a7454877] (rid 92803) by welch on 2000-10-26 08:13:45:

    1. closedate changed to: "2000-10-26T01:13:45"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [598013e3cc] (rid 117988) by dgp on 2001-04-16 23:39:04:

    1. closedate changed to: "2001-04-16T16:39:04"
    2. closer changed to: "dgp"
    3. resolution changed to: "Invalid"
    4. subsystem changed to: "None"