Artifacts Associated With Ticket 1804709
Ticket change [8f0ad02771] (rid 120216) by vovchook on 2007-09-29 12:22:07:
- assignee initialized to: "nijtmans"
- cmimetype initialized to: "text/plain"
- 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. - foundin initialized to: "obsolete: 8.4.16"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "vovchook"
- subsystem initialized to: "14. List Object"
- title initialized to: "memory leak"
- type initialized to: "Bug"
Ticket change [6c1607e6e8] (rid 128437) by dkf on 2007-09-30 06:40:33:
- 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.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [cb1f1e0e45] (rid 95471) by dkf on 2007-09-30 06:40:34:
- assignee changed to: "dkf"
- closedate changed to: "2007-09-29T23:40:34"
- closer changed to: "dkf"
- resolution changed to: "Invalid"
- status changed to: "Closed"