Skip to content
Tcl Source Code History Of Ticket 1804709
Login

History Of Ticket 1804709

Artifacts Associated With Ticket 1804709

  1. Ticket change [8f0ad02771] (rid 120216) by vovchook on 2007-09-29 12:22:07:

    1. assignee initialized to: "nijtmans"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Tcl 8.4.* (8.4.16 for example), Win2000
      
      After this script
      #################################
      for {set i 1} {$i<=1000000} {incr i} {
      lappend lst [string repeat * 40]
      }
      unset lst
      #################################
      windows tasks manager shows ~90Mb of memory usage.
      Another script:
      set str [string repeat * 40]
      ##############################################
      for {set i 1} {$i<=1000000} {incr i} {
      lappend lst $str
      }
      unset lst
      ##############################################
      - no problem.
      A have a lot of problems in my proframs that deal with textual files. After leaving of procedures - a lot of memory remains captured which must be freed.
      
    4. foundin initialized to: "obsolete: 8.4.16"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "vovchook"
    10. subsystem initialized to: "14. List Object"
    11. title initialized to: "memory leak"
    12. type initialized to: "Bug"
  2. Ticket change [6c1607e6e8] (rid 128437) by dkf on 2007-09-30 06:40:33:

    1. icomment:
      Logged In: YES 
      user_id=79902
      Originator: NO
      
      This is not a bug: this is exactly how things are designed to work. In the second case (behind the scenes) each value in the list is actually read-only shared with all the others, but in the first case each of the members is not shared since the Tcl implementation is not smart enough to figure out that [string repeat] can be shared when the inputs are identical. Making it smart enough is a lot of work for arguably an uncommon case, so we don't. :-)
      
      The memory is only not returned to the OS because Tcl uses a high-water-mark allocator. You can tell it is not a "real leak" because if you run the "leaky" code again (including the [unset]), the memory requirements remain the same.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  3. Ticket change [cb1f1e0e45] (rid 95471) by dkf on 2007-09-30 06:40:34:

    1. assignee changed to: "dkf"
    2. closedate changed to: "2007-09-29T23:40:34"
    3. closer changed to: "dkf"
    4. resolution changed to: "Invalid"
    5. status changed to: "Closed"