Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 66a7c28320930fd531b18680675372179de3ac38
Ticket: 2874678fffffffffffffffffffffffffffffffff
dict incr leaks
User & Date: wastl-nagel on 2009-10-08 12:35:15
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    If a dict is created and filled via "dict incr" with a bigger set of keys it seems to leak. If the dict is destroyed (unset or overwritten) a lot of memory still keeps allocated. 
    
    The following code consumes approx. 500MB memory on my machine (Linux, 64-bit):
    
    set chars {a b c d e f g h i j k l m n o p q r s t u v w x y z
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
    0 1 2 3 4 5 6 7 8 9}
    
    for {set i 0} {$i < 1000} {incr i} {
    append prefix [lindex $chars [expr int([tcl::mathfunc::rand]*62)]]
    set dictionary [dict create]
    foreach char $chars {
    foreach c $chars {
    dict incr dictionary $prefix$char$c $i
    }
    }
    }
    
    I've tested Tcl 8.5.2 (OpenSuSE 11.0, x86_64), 8.5.7, 8.6b1 (both built from source), 
    all three leak, cf. attached valgrind log files for same code but only 100 cycles.
    
    For 8.5.2 TclBN_mp_init_size according to valgrind seems to be reason.
    
    % uname -mrvs
    Linux 2.6.25.20-0.5-default #1 SMP 2009-08-14 01:48:11 +0200 x86_64
    
  4. foundin changed to: "obsolete: 8.5.7"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "wastl-nagel"
  10. subsystem changed to: "15. Dict Object"
  11. title changed to: "dict incr leaks"
  12. type changed to: "Bug"