Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 71be4bf5e4b47a8f88928d2730e8b423310cd0c7
Ticket: 3394654fffffffffffffffffffffffffffffffff
leak due to non closing base of stacked channels
User & Date: dgp on 2011-08-19 16:13:48
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    $ cat leak.tcl
        set nested 0
        proc foo {fd args} {
            switch -exact [lindex $args 0] {
                initialize {return {initialize finalize read write}}
                finalize {return {}}
            }
            global nested
            if {$nested} {
                return
            }
            set nested 1
            chan pop $fd
        }
        set b [open /dev/null w]
        set c [chan push $b [list foo $b]]
        puts $c a
        flush $c
        close $c
    
    $ valgrind --leak-check=yes ./tclsh leak.tcl
    ...
    ==27262== 8,577 (16 direct, 8,561 indirect) bytes in 1 blocks are definitely lost in loss record 20 of 20
    ==27262==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
    ==27262==    by 0x482844: Tcl_Alloc (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    ==27262==    by 0x453534: TclpOpenFileChannel (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    ==27262==    by 0x42066F: Tcl_FSOpenFileChannel (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    ==27262==    by 0x4E0073: Tcl_OpenObjCmd (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    ==27262==    by 0x47CF39: TclNREvalObjv (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    ==27262==    by 0x47D583: Tcl_EvalObjv (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    ==27262==    by 0x47DFF3: TclEvalEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    ==27262==    by 0x42CE58: TclSubstTokens (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    ==27262==    by 0x47D8BF: TclEvalEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    ==27262==    by 0x47E325: Tcl_EvalEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    ==27262==    by 0x421169: Tcl_FSEvalFileEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
    
    
  4. foundin changed to: "obsolete: 8.6b2"
  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: "dgp"
  10. subsystem changed to: "26. Channel Transforms"
  11. title changed to: "leak due to non closing base of stacked channels"
  12. type changed to: "Bug"