Artifacts Associated With Ticket c7d0bc9a549714e0
Ticket change [d39da93dea] (rid 148783) by mr_calvin on 2016-09-15 10:41:54:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
The recently applied changes in response to http://core.tcl.tk/tcl/tktview?name=d4e7780ca1 open up a Tcl_Obj leak because refcounting was not adjusted accordingly, e.g.: ==28916== 93 (48 direct, 45 indirect) bytes in 1 blocks are definitely lost in loss record 35 of 64 ==28916== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299) ==28916== by 0x50ED4F2: TclpAlloc (tclAlloc.c:699) ==28916== by 0x5104DDC: Tcl_Alloc (tclCkalloc.c:1059) ==28916== by 0x521525E: TclCreateLiteral (tclLiteral.c:236) ==28916== by 0x52155F9: TclRegisterLiteral (tclLiteral.c:445) ==28916== by 0x51A0F99: CompileCmdLiteral (tclCompile.c:1794) ==28916== by 0x51A1242: TclCompileInvocation (tclCompile.c:1814) ==28916== by 0x51A252B: CompileCommandTokens (tclCompile.c:2074) ==28916== by 0x51A2940: TclCompileScript (tclCompile.c:2193) ==28916== by 0x51A3BE6: TclCompileTokens (tclCompile.c:2442) ==28916== by 0x5157AFC: TclCompileNamespaceTailCmd (tclCompCmdsGR.c:2055) ==28916== by 0x51C2F67: TclAttemptCompileProc (tclEnsemble.c:3212) The literal Tcl_Obj kept being bumped to reflect a global literal reference unconditionally, i.e., even when it is treated as unshared, local-only literal in subsequent steps. The fix is to move Tcl_IncrRefCount(objPtr) further down in TclCreateLiteral(), when it becomes certain that the literal actually becomes global. I would also suggest adjusting the in-code comments slightly, to better reflect the modified literal handling. See attached path for both.
- foundin initialized to: "core-8-6-branch"
- is_private initialized to: "0"
- login: "mr_calvin"
- priority initialized to: "5 Medium"
- private_contact initialized to: "d4d1d8192a46acf2c7d58cddc1040ecdbc9c9d77"
- resolution initialized to: "None"
- severity initialized to: "Critical"
- status initialized to: "Open"
- submitter initialized to: "mr_calvin"
- subsystem initialized to: "45. Parsing and Eval"
- title initialized to:
Newly introduced unshared (local-only) literals from cmd resolvers cause Tcl_Obj leaks
- type initialized to: "Bug"
Add attachment "unsharedLiteral.patch" [2f7cc1858e] (rid 148784) by mr_calvin on 2016-09-15 10:42:12.
Ticket change [5ba697742f] (rid 148785) by mr_calvin on 2016-09-15 10:43:24:
- assignee changed to: "jan.nijtmans"
- icomment:
Assigned to Jan, because he also sponsored the original patch.
- login: "mr_calvin"
- mimetype: "text/plain"
Ticket change [be1a07d8a6] (rid 148790) by jan.nijtmans on 2016-09-15 13:27:56:
- icomment:
Proposed fix committed to branch bug-c7d0bc9a549714e0. Appears fully valid to me. Asking feedback from Gustaf Neumann.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [fc61efd0e4] (rid 148792) by gustafn2 on 2016-09-16 07:51:08:
- icomment:
The fix is correct. i did some larger tests (naviserver, valgrind, ...) everything looks ok.
- login: "gustafn2"
- mimetype: "text/plain"
- icomment:
Ticket change [383b9e2aca] (rid 148795) by jan.nijtmans on 2016-09-16 09:09:50:
- icomment:
Fix committed to core-8-6-branch and trunk. In-code oomments not taken into account yet, I'll leave that in the hands of Gustaf. Therefore keeping this ticket open for the moment.
- login: "jan.nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- icomment:
Ticket change [737509a1d5] (rid 148831) by gustafn2 on 2016-09-21 09:08:06:
- icomment:
The modified inline comments reflect the differentiation between global (shared) and unshared literals properly.
- login: "gustafn2"
- mimetype: "text/plain"
- icomment:
Ticket change [f7bcc5e0a6] (rid 148840) by jan.nijtmans on 2016-09-21 09:30:54:
- closedate changed to: "2457652.89646866"
- closer changed to: "jan.nijtmans"
- icomment:
Better inline comment handled by "trunk" now. Closing
- login: "jan.nijtmans"
- mimetype: "text/plain"
- status changed to: "Closed"