mem leaks in iocmd.tf-32.0
Closed / Fixed12b0997ce75118f2b5f6fe9b5c1853e3de12031bCreated 12 years agoUpdated 12 years ago
Descriptionplain2014-07-21 14:32:45
==7719== 136 bytes in 1 blocks are definitely lost in loss record 18 of 22 ==7719== at 0x4A0610C: malloc (vg_replace_malloc.c:195) ==7719== by 0x5D1CA6: TclpAlloc (tclAlloc.c:699) ==7719== by 0x43D296: Tcl_Alloc (tclCkalloc.c:1059) ==7719== by 0x53A13B: TclChanCreateObjCmd (tclIORChan.c:670) ==7719== by 0x430A40: Dispatch (tclBasic.c:4357) ==7719== by 0x430AC0: TclNRRunCallbacks (tclBasic.c:4390) ==7719== by 0x430365: Tcl_EvalObjv (tclBasic.c:4121) ==7719== by 0x4327F4: TclEvalEx (tclBasic.c:5259) ==7719== 1,175 (56 direct, 1,119 indirect) bytes in 1 blocks are definitely lost in loss record 22 of 22 ==7719== at 0x4A0610C: malloc (vg_replace_malloc.c:195) ==7719== by 0x5D1CA6: TclpAlloc (tclAlloc.c:699) ==7719== by 0x43D296: Tcl_Alloc (tclCkalloc.c:1059) ==7719== by 0x52A807: Tcl_CreateChannel (tclIO.c:1557) ==7719== by 0x53A0EF: TclChanCreateObjCmd (tclIORChan.c:657) ==7719== by 0x430A40: Dispatch (tclBasic.c:4357) ==7719== by 0x430AC0: TclNRRunCallbacks (tclBasic.c:4390) ==7719== by 0x430365: Tcl_EvalObjv (tclBasic.c:4121)
Referenced by2
79ff19ba73[12b0997ce7] Plug memleak in iocmd.tf-32.0 . check-in2014-07-22 17:04:151c054c06c9[12b0997ce7] Plug memleak in iocmd.tf-32.0 . check-in2014-07-22 16:44:38
dgpplain2014-07-22 15:22:43
The trouble here is that when the origin thread of a reflected channel is terminated, that reflected channel is marked as "dead". Forwarded ops on "dead" channels bail out early with the "Owner lost" message. When the op is "close" however, this early bailout means that the cleanup of RC structs is skipped, leading to the mem leak. Fix is to relocate RC struct cleanup to where it will not be skipped. pending...
dgpplain2014-07-22 15:59:09
That task is more complicated than expected because the Tcl_Obj's held in the rcPtr have to be freed in the same thread where they are created.
dgpplain2014-07-22 16:45:20
Fix commited to a testing/merging branch.
dgpplain2014-07-22 16:57:08
Reflected channels in 8.5 and 8.6 have already diverged. Not backporting.
dgpplain2014-07-22 17:04:44
fixed for 8.6.2.
Log in (anonymous is fine) to add a comment.