Skip to content
Tcl Source Code View Ticket
Login

View Ticket

ThreadReflectedChannelMap leak

Closed / Fixed3396948fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2011-08-23 15:41:29
$ cat leak.tcl
    proc foo {args} {return {initialize finalize watch read}}
    close [chan create r foo]
$ valgrind --leak-check=yes ./tclsh leak.tcl
...
==29335== 88 bytes in 1 blocks are definitely lost in loss record 16 of 20
==29335==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
==29335==    by 0x49FA82: TclpAlloc (tclAlloc.c:705)
==29335==    by 0x4B1086: Tcl_Alloc (tclCkalloc.c:1046)
==29335==    by 0x426520: GetThreadReflectedChannelMap (tclIORChan.c:2573)
==29335==    by 0x4244A6: TclChanCreateObjCmd (tclIORChan.c:720)
==29335==    by 0x4A51B4: TclNREvalObjv (tclBasic.c:4273)
==29335==    by 0x4A7CBC: TclNREvalObjEx (tclBasic.c:5984)
==29335==    by 0x4AAA9C: Tcl_NREvalObj (tclBasic.c:8181)
==29335==    by 0x5235DA: NsEnsembleImplementationCmdNR (tclEnsemble.c:1858)
==29335==    by 0x4A550E: NRRunObjProc (tclBasic.c:4366)
==29335==    by 0x4A52DF: TclNRRunCallbacks (tclBasic.c:4315)
==29335==    by 0x4A4CFE: Tcl_EvalObjv (tclBasic.c:4107)
dgpplain2011-08-23 23:00:39
Looks like a simple one.  Thread exit handler
DeleteThreadReflectedChannelMap() is simply
missing a ckfree() call.
dgpplain2011-08-23 23:31:20
allow_comments - 1

Moved a few mutexes as well in the
patch applied to trunk.
dgpplain2011-08-25 19:47:01
allow_comments - 0

Very similar leaks of ReflectedTransformMap
are also present, but attempting the same simple
fix to them lead to segfaults.
dgpplain2011-08-29 21:37:04
allow_comments - 1
Log in (anonymous is fine) to add a comment.