Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2014-07-11
15:45 • Closed ticket [9b352768e6]: memleak in dict-20.16 plus 7 other changes artifact: 79c8e1aaee user: dgp
15:44
[9b352768e6] Plug memleak in INST_DICT_FIRST. check-in: e88e23fbdb user: dgp tags: trunk
15:31 • Ticket [9b352768e6] memleak in dict-20.16 status still Open with 3 other cha... artifact: 6a1ecf7acc user: dgp
14:32 • Ticket [9b352768e6]: 3 changes artifact: 4be4f1d39d user: dgp
14:31 • Ticket [9b352768e6]: 3 changes artifact: f1bc7c106c user: dgp
14:29 • Ticket [9b352768e6]: 3 changes artifact: 1c54641d96 user: dgp
13:25 • New ticket [9b352768e6]. artifact: 63e57950f3 user: dgp

memleak in dict-20.16

Closed / Fixed9b352768e6d78c8dbf522a8d58b794b376187246Created 12 years agoUpdated 12 years ago
Descriptionplain2014-07-11 13:25:14
==21764== 58 (48 direct, 10 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 7
==21764==    at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==21764==    by 0x5D142A: TclpAlloc (tclAlloc.c:699)
==21764==    by 0x43D1AE: Tcl_Alloc (tclCkalloc.c:1059)
==21764==    by 0x548506: TclCreateLiteral (tclLiteral.c:236)
==21764==    by 0x54890F: TclRegisterLiteral (tclLiteral.c:434)
==21764==    by 0x4667ED: TclCompileDictMergeCmd (tclCompCmds.c:1272)
==21764==    by 0x4F99E2: TclAttemptCompileProc (tclEnsemble.c:3081)
==21764==    by 0x4F977F: TclCompileEnsemble (tclEnsemble.c:3004)
Referenced by1
dgpplain2014-07-11 14:29:43
% proc demo {} {dict merge {a b c d} {e f g h i}}
% tcl::unsupported::disassemble proc demo
ByteCode 0x0x15c2cc10, refCt 1, epoch 15, interp 0x0x15bda5d0 (epoch 15)
  Source "dict merge {a b c d} {e f g h i}"
  Cmds 1, src 32, inst 79, litObjs 2, aux 0, stkDepth 3, code/src 0.00
  Proc 0x0x15c27a70, refCt 1, args 0, compiled locals 4
      slot 0, scalar, temp
      slot 1, scalar, temp
      slot 2, scalar, temp
      slot 3, scalar, temp
  Exception ranges 1, depth 1:
      0: level 0, catch, pc 12-50, catch 62
  Commands 1:
      1: pc 0-77, src 0-31
  Command 1: "dict merge {a b c d} {e f g h i}"
    (0) push1 0 	# "a b c d"
    (2) dup 
    (3) verifyDict 
    (4) storeScalar1 %v2 	# temp var 2
    (6) pop 
    (7) beginCatch4 0 
    (12) push1 1 	# "e f g h i"
    (14) dictFirst %v3 	# temp var 3
    (19) jumpTrue1 +24 	# pc 43
    (21) reverse 2 
    (26) dictSet 1 %v2 	# temp var 2
    (35) pop 
    (36) dictNext %v3 	# temp var 3
    (41) jumpFalse1 -20 	# pc 21
    (43) pop 
    (44) pop 
    (45) unsetScalar 0 %v3 	# temp var 3
    (51) endCatch 
    (52) loadScalar1 %v2 	# temp var 2
    (54) unsetScalar 0 %v2 	# temp var 2
    (60) jump1 +18 	# pc 78
    (62) pushReturnOpts 
    (63) pushResult 
    (64) endCatch 
    (65) unsetScalar 0 %v2 	# temp var 2
    (71) unsetScalar 0 %v3 	# temp var 3
    (77) returnStk 
    (78) done
dgpplain2014-07-11 14:31:20
I see 

    (7) beginCatch4 0 
...
    (51) endCatch 
...
    (64) endCatch 

which looks like something's out of balance to me.
dgpplain2014-07-11 14:32:36
I see 

    (7) beginCatch4 0 
...
    (51) endCatch 
...
    (64) endCatch 

which looks like something's out of balance to me.
dgpplain2014-07-11 15:31:07
No, that's not it.  Trouble is some missing
refcount management in the INST_DICT_FIRST
instruction.
dgpplain2014-07-11 15:45:40
Fixed on trunk.
Log in (anonymous is fine) to add a comment.