Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6c1607e6e8b36b5cedde6935de1ce0e0999f3a20
Ticket: 1804709fffffffffffffffffffffffffffffffff
memory leak
User & Date: dkf on 2007-09-30 06:40:33
Changes

  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"