|
2005-04-17
| ||
| 02:14 | • Closed ticket [1084111fff]: memory leak in array names plus 8 other change... artifact: 3097838597 user: msofer | |
|
2005-04-16
| ||
| 22:38 | • Ticket [1084111fff]: 1 change artifact: 820fba7774 user: msofer | |
|
2004-12-13
| ||
| 09:21 | • Open ticket [1084111fff]. artifact: 73f6683a2e user: msofer | |
| 08:55 | • Closed ticket [1084111fff]. artifact: cce672283c user: msofer | |
| 08:39 | • Ticket [1084111fff]: 5 changes artifact: 7b7028ecd9 user: msofer | |
| 01:23 | • New ticket [1084111fff]. artifact: 6b70d04094 user: pointsman | |
memory leak in [array names]
Closed / Fixed1084111fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-12-13 01:23:23
tcl head as of 2004-12-13 02:19:05 CET
This script let tclsh8.5 (slowly) grow indefinitely:
package require tcltest
while {1} {
namespace import ::tcltest::*
namespace forget ::tcltest::*
}
(It's only 24 bytes per loop. That is, grows slow
enough to watch it with top without real danger.)
valgrind tells me, that the spot is:
24 bytes in 1 blocks are definitely lost in loss record
1 of 3
at 0x40027B98: malloc (vg_replace_malloc.c:153)
by 0x40251A5D: TclpAlloc (../generic/tclAlloc.c:685)
by 0x40259325: Tcl_Alloc (../generic/tclCkalloc.c:1018)
by 0x402C511B: Tcl_NewObj (../generic/tclObj.c:628)
by 0x402EA208: Tcl_ArrayObjCmd
(../generic/tclVar.c:2924)
by 0x40254CAB: TclEvalObjvInternal
(../generic/tclBasic.c:3053)
by 0x4028F528: TclExecuteByteCode
(../generic/tclExecute.c:1629)
by 0x4028DC16: TclCompEvalObj
(../generic/tclExecute.c:980)
by 0x402D6D5F: TclObjInterpProc
(../generic/tclProc.c:1126)
by 0x40254CAB: TclEvalObjvInternal
(../generic/tclBasic.c:3053)
by 0x40254EE4: Tcl_EvalObjv (../generic/tclBasic.c:3167)
by 0x402BDC8C: Tcl_Import (../generic/tclNamesp.c:1392)
by 0x402C01EC: NamespaceImportCmd
(../generic/tclNamesp.c:3544)
by 0x402BF279: Tcl_NamespaceObjCmd
(../generic/tclNamesp.c:2800)
by 0x40254CAB: TclEvalObjvInternal
(../generic/tclBasic.c:3053)
by 0x402557F5: Tcl_EvalEx (../generic/tclBasic.c:3537)
by 0x402B4CF3: Tcl_FSEvalFileEx
(../generic/tclIOUtil.c:1687)
by 0x402BC0B4: Tcl_Main (../generic/tclMain.c:434)
by 0x8048705: main (tclAppInit.c:87)
by 0x4035D8AD: __libc_start_main (in /lib/libc.so.6)
by 0x8048630: (within /usr/local/tcl-head/bin/tclsh8.5)
msoferplain2004-12-13 08:39:18
Logged In: YES
user_id=148712
Confirmed by running the script
namespace eval a {
proc x args {set x}
namespace export *
}
while 1 {
namespace import a::*
namespace forget a::*
}
and watching it in top.
msoferplain2004-12-13 08:55:23
Logged In: YES user_id=148712 Great catch and report, thank you. Fixed in HEAD, 8.4 is immune.
msoferplain2004-12-13 09:21:53
Logged In: YES user_id=148712 Spoke too soon - one leak plugged, but there's some more ...
msofer Ticket [1084111fff]: 1 change
[History diff]2005-04-16 22:38:08
msoferplain2005-04-17 02:14:57
Logged In: YES user_id=148712 Fixed in HEAD. Both leaks were due to refCount mismanagement in the code for [array names]. The second one only appeared when the array was empty - hence in the test script down below, but not in the original script in the report. This ticket's summary was edited accordingly.
Log in (anonymous is fine) to add a comment.