Overview
| Artifact ID: | d39da93dea4fb01207651dca2a8e7f3c516085bb |
|---|---|
| Ticket: | c7d0bc9a549714e031971ea60e6b0392b51d0d75
Newly introduced unshared (local-only) literals from cmd resolvers cause Tcl_Obj leaks |
| User & Date: | mr_calvin on 2016-09-15 10:41:54 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed 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 changed to: "core-8-6-branch"
- is_private changed to: "0"
- login: "mr_calvin"
- priority changed to: "5 Medium"
- private_contact changed to: "d4d1d8192a46acf2c7d58cddc1040ecdbc9c9d77"
- resolution changed to: "None"
- severity changed to: "Critical"
- status changed to: "Open"
- submitter changed to: "mr_calvin"
- subsystem changed to: "45. Parsing and Eval"
- title changed to:
Newly introduced unshared (local-only) literals from cmd resolvers cause Tcl_Obj leaks
- type changed to: "Bug"