Menu

#1848 Improper memory clean up at exit

obsolete: 8.4a4
closed-out-of-date
5
2014-12-31
2002-04-14
Anonymous
No

Even compiled with -DPURIFY and with the exit
redefinition "magic" from
http://mini.net/cgi-bin/wikit/3248.html (which
ensures, that even the main interp is deleted,
which normaly not happens) tcl 8.4a4 doesn't
clean up it's memory completely at exit, even
with the smallest possible script.

Using mpatrol, I found in total 18 not freed
allocations. I'll append stack traces for all of
this allocations with references to the code at
the end.

I think, all of them doesn't really hurt, because
it's (limitied) memory, that is allocated during
special initializations. As far as I can see,
there is no way, to 'exploit' any of these leaks
to write scripts, that results in an always
growing tclsh process.

Because of this, I think this has really (very)
low priority. It's only a bit annoying "noise"
for those, who try to memory debug the core.

One problem, for example, is the static Tcl_Obj
*tclStartupScriptPath in TclMain.c, which is
filled, if the tclsh is called with a script, but
it's never freed. Freeing tclStartupScriptPath
could be easily done with something like

if (TclGetStartupScriptPath()) {
Tcl_DecrRefCount (TclGetStartupScriptPath());
}

befor the

Tcl_Release((ClientData) interp);
Tcl_Exit(exitCode);

at the end of Tcl_Main().

An other problem is, that the static Tcl_Encoding
structure systemEncoding (static to
tclEncoding.c) is filled, during the
initializing, but never properly freed. That
should also easily fixable, with a new trivial
function in tclEncoding.c, like this

void
TclFreeSystemEncoding()
{
Tcl_FreeEncoding (systemEncoding);
}

the necessary declaration at the top of tclMain.c

EXTERN void TclFreeSystemEncoding();

and a call to that at the same place, as above.

With this changes, most of the above noted 18 not
freed allocations are properly freed,

rolf

0x08104380 (268 bytes) {malloc:563:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x08085F34 LoadTableEncoding+244 at
./../generic/tclEncoding.c:1389
0x08085CE6 LoadEncodingFile+390 at
./../generic/tclEncoding.c:1236
0x080851DE Tcl_GetEncoding+62 at
./../generic/tclEncoding.c:418
0x080854F2 Tcl_SetSystemEncoding+34 at
./../generic/tclEncoding.c:677
0x08064922 TclpSetInitialEncodings+466 at
./../unix/tclUnixInit.c:573
0x080874C0 TclFindEncodings+128 at
./../generic/tclEncoding.c:2792
0x08085AE2 Tcl_FindExecutable+114 at
./../generic/tclEncoding.c:1145
0x08054661 Tcl_Main+65 at ./../generic/tclMain.c:229
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x0810448C (1536 bytes) {malloc:564:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x08085F6D LoadTableEncoding+301 at
./../generic/tclEncoding.c:1401
0x08085CE6 LoadEncodingFile+390 at
./../generic/tclEncoding.c:1236
0x080851DE Tcl_GetEncoding+62 at
./../generic/tclEncoding.c:418
0x080854F2 Tcl_SetSystemEncoding+34 at
./../generic/tclEncoding.c:677
0x08064922 TclpSetInitialEncodings+466 at
./../unix/tclUnixInit.c:573
0x080874C0 TclFindEncodings+128 at
./../generic/tclEncoding.c:2792
0x08085AE2 Tcl_FindExecutable+114 at
./../generic/tclEncoding.c:1145
0x08054661 Tcl_Main+65 at ./../generic/tclMain.c:229
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x08179254 (24 bytes) {malloc:2910:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x080553D7 Tcl_NewObj+23 at ./../generic/tclObj.c:525
0x080A493B Tcl_FSJoinPath+123 at
./../generic/tclIOUtil.c:2804
0x08094EB8 Tcl_FSJoinToPath+88 at
./../generic/tclFileName.c:1044
0x080A55FD SetFsPathFromAny+845 at
./../generic/tclIOUtil.c:3650
0x080553A5 Tcl_ConvertToType+37 at ./../generic/tclObj.c:473
0x080A514B Tcl_FSConvertToPathType+91 at
./../generic/tclIOUtil.c:3398
0x080A58EE Tcl_FSGetTranslatedPath+30 at
./../generic/tclIOUtil.c:3873
0x080A3875 Tcl_FSEvalFile+37 at
./../generic/tclIOUtil.c:1221
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081792FC (10 bytes) {malloc:574:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x08085598 Tcl_CreateEncoding+88 at
./../generic/tclEncoding.c:738
0x08086412 LoadTableEncoding+1490 at
./../generic/tclEncoding.c:1542
0x08085CE6 LoadEncodingFile+390 at
./../generic/tclEncoding.c:1236
0x080851DE Tcl_GetEncoding+62 at
./../generic/tclEncoding.c:418
0x080854F2 Tcl_SetSystemEncoding+34 at
./../generic/tclEncoding.c:677
0x08064922 TclpSetInitialEncodings+466 at
./../unix/tclUnixInit.c:573
0x080874C0 TclFindEncodings+128 at
./../generic/tclEncoding.c:2792
0x08085AE2 Tcl_FindExecutable+114 at
./../generic/tclEncoding.c:1145
0x08054661 Tcl_Main+65 at ./../generic/tclMain.c:229
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x08179594 (53 bytes) {malloc:588:0} [-|-|-]
0x4005BAFB __open_catalog+1275 at open_catalog.c:234
0x4005F12C __unsetenv+28 at ../sysdeps/generic/setenv.c:270
0x40078908 ____strtod_l_internal+10680 at strtod.c:993
0x4002C6A6 __csinh+390 at
../sysdeps/libm-ieee754/s_csinh.c:94
0x4005E11E abort+398 at ../sysdeps/generic/abort.c:128
0x4002C710 __csinh+496 at
../sysdeps/libm-ieee754/s_csinh.c:100
0x40037543 __sinhl+83 at
../sysdeps/libm-ieee754/w_sinhl.c:41
0x4003B0A3 T+107
0x400D35B1 __sleep+305 at
../sysdeps/unix/sysv/linux/sleep.c:82
0x08064933 TclpSetInitialEncodings+483 at
./../unix/tclUnixInit.c:587
0x080874C0 TclFindEncodings+128 at
./../generic/tclEncoding.c:2792
0x08085AE2 Tcl_FindExecutable+114 at
./../generic/tclEncoding.c:1145
0x08054661 Tcl_Main+65 at ./../generic/tclMain.c:229
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081797B0 (36 bytes) {malloc:575:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x080855A1 Tcl_CreateEncoding+97 at
./../generic/tclEncoding.c:740
0x08086412 LoadTableEncoding+1490 at
./../generic/tclEncoding.c:1542
0x08085CE6 LoadEncodingFile+390 at
./../generic/tclEncoding.c:1236
0x080851DE Tcl_GetEncoding+62 at
./../generic/tclEncoding.c:418
0x080854F2 Tcl_SetSystemEncoding+34 at
./../generic/tclEncoding.c:677
0x08064922 TclpSetInitialEncodings+466 at
./../unix/tclUnixInit.c:573
0x080874C0 TclFindEncodings+128 at
./../generic/tclEncoding.c:2792
0x08085AE2 Tcl_FindExecutable+114 at
./../generic/tclEncoding.c:1145
0x08054661 Tcl_Main+65 at ./../generic/tclMain.c:229
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x0817F8E0 (1536 bytes) {malloc:570:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x080861C0 LoadTableEncoding+896 at
./../generic/tclEncoding.c:1466
0x08085CE6 LoadEncodingFile+390 at
./../generic/tclEncoding.c:1236
0x080851DE Tcl_GetEncoding+62 at
./../generic/tclEncoding.c:418
0x080854F2 Tcl_SetSystemEncoding+34 at
./../generic/tclEncoding.c:677
0x08064922 TclpSetInitialEncodings+466 at
./../unix/tclUnixInit.c:573
0x080874C0 TclFindEncodings+128 at
./../generic/tclEncoding.c:2792
0x08085AE2 Tcl_FindExecutable+114 at
./../generic/tclEncoding.c:1145
0x08054661 Tcl_Main+65 at ./../generic/tclMain.c:229
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CC160 (24 bytes) {malloc:1265:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x0805A869 Tcl_NewStringObj+73 at
./../generic/tclStringObj.c:207
0x080545CB TclSetStartupScriptFileName+27 at
./../generic/tclMain.c:156
0x0805472C Tcl_Main+268 at ./../generic/tclMain.c:263
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CC178 (11 bytes) {malloc:1266:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x0805A8B9 Tcl_NewStringObj+153 at
./../generic/tclStringObj.c:208
0x080545CB TclSetStartupScriptFileName+27 at
./../generic/tclMain.c:156
0x0805472C Tcl_Main+268 at ./../generic/tclMain.c:263
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CC1F8 (54 bytes) {malloc:3132:0} [-|-|-]
0x4005BAFB __open_catalog+1275 at open_catalog.c:234
0x4005F12C __unsetenv+28 at ../sysdeps/generic/setenv.c:270
0x40078908 ____strtod_l_internal+10680 at strtod.c:993
0x4002C6A6 __csinh+390 at
../sysdeps/libm-ieee754/s_csinh.c:94
0x4005E11E abort+398 at ../sysdeps/generic/abort.c:128
0x4002C710 __csinh+496 at
../sysdeps/libm-ieee754/s_csinh.c:100
0x40037543 __sinhl+83 at
../sysdeps/libm-ieee754/w_sinhl.c:41
0x4003B0A3 T+107
0x080C77C9 TclpFree+25 at ./../generic/tclAlloc.c:697
0x0806B239 Tcl_Free+25 at ./../generic/tclCkalloc.c:1161
0x0805B9AC FreeStringInternalRep+28 at
./../generic/tclStringObj.c:1812
0x080554A7 TclFreeObj+39 at ./../generic/tclObj.c:706
0x08063833 TclDeleteVars+339 at ./../generic/tclVar.c:5019
0x080A94F5 TclTeardownNamespace+213 at
./../generic/tclNamesp.c:743
0x080656A6 DeleteInterpProc+102 at
./../generic/tclBasic.c:995
0x08058079 Tcl_Release+185 at ./../generic/tclPreserve.c:242
0x08054D81 Tcl_Main+1889 at ./../generic/tclMain.c:530
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CC4D8 (45 bytes) {malloc:3063:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x080A5BAA NativeCreateNativeRep+90 at
./../generic/tclIOUtil.c:4185
0x080A5B06 Tcl_FSGetInternalRep+118 at
./../generic/tclIOUtil.c:4105
0x080A5B40 Tcl_FSGetNativePath+32 at
./../generic/tclIOUtil.c:4147
0x080BA8B9 TclpObjStat+25 at ./../unix/tclUnixFile.c:692
0x080A3C51 Tcl_FSStat+257 at ./../generic/tclIOUtil.c:1452
0x080A38B2 Tcl_FSEvalFile+98 at
./../generic/tclIOUtil.c:1228
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CC508 (24 bytes) {malloc:2971:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x0805A869 Tcl_NewStringObj+73 at
./../generic/tclStringObj.c:207
0x080A49EA Tcl_FSJoinPath+298 at
./../generic/tclIOUtil.c:2826
0x080A3375 FSNormalizeAbsolutePath+277 at
./../generic/tclIOUtil.c:889
0x080A40D3 Tcl_FSGetCwd+99 at ./../generic/tclIOUtil.c:1862
0x080A59C8 Tcl_FSGetNormalizedPath+104 at
./../generic/tclIOUtil.c:3969
0x080A5E69 Tcl_FSGetFileSystemForPath+57 at
./../generic/tclIOUtil.c:4497
0x080A3C39 Tcl_FSStat+233 at ./../generic/tclIOUtil.c:1449
0x080A38B2 Tcl_FSEvalFile+98 at
./../generic/tclIOUtil.c:1228
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CC520 (34 bytes) {realloc:2972:5}
[TclpRealloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|720]
0x080C77ED TclpRealloc+29 at ./../generic/tclAlloc.c:721
0x0806B12F Tcl_Realloc+31 at ./../generic/tclCkalloc.c:1085
0x0805AD69 Tcl_SetObjLength+105 at
./../generic/tclStringObj.c:765
0x08094F9E TclpNativeJoinPath+190 at
./../generic/tclFileName.c:1112
0x080A4A49 Tcl_FSJoinPath+393 at
./../generic/tclIOUtil.c:2854
0x080A3375 FSNormalizeAbsolutePath+277 at
./../generic/tclIOUtil.c:889
0x080A40D3 Tcl_FSGetCwd+99 at ./../generic/tclIOUtil.c:1862
0x080A59C8 Tcl_FSGetNormalizedPath+104 at
./../generic/tclIOUtil.c:3969
0x080A5E69 Tcl_FSGetFileSystemForPath+57 at
./../generic/tclIOUtil.c:4497
0x080A3C39 Tcl_FSStat+233 at ./../generic/tclIOUtil.c:1449
0x080A38B2 Tcl_FSEvalFile+98 at
./../generic/tclIOUtil.c:1228
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CC544 (24 bytes) {malloc:2980:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x080A5265 SetFsPathFromAbsoluteNormalized+149 at
./../generic/tclIOUtil.c:3482
0x080A338A FSNormalizeAbsolutePath+298 at
./../generic/tclIOUtil.c:909
0x080A40D3 Tcl_FSGetCwd+99 at ./../generic/tclIOUtil.c:1862
0x080A59C8 Tcl_FSGetNormalizedPath+104 at
./../generic/tclIOUtil.c:3969
0x080A5E69 Tcl_FSGetFileSystemForPath+57 at
./../generic/tclIOUtil.c:4497
0x080A3C39 Tcl_FSStat+233 at ./../generic/tclIOUtil.c:1449
0x080A38B2 Tcl_FSEvalFile+98 at
./../generic/tclIOUtil.c:1228
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CC614 (24 bytes) {malloc:3051:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x0805A869 Tcl_NewStringObj+73 at
./../generic/tclStringObj.c:207
0x080A49EA Tcl_FSJoinPath+298 at
./../generic/tclIOUtil.c:2826
0x080A3375 FSNormalizeAbsolutePath+277 at
./../generic/tclIOUtil.c:889
0x080A5A16 Tcl_FSGetNormalizedPath+182 at
./../generic/tclIOUtil.c:3982
0x080A5E69 Tcl_FSGetFileSystemForPath+57 at
./../generic/tclIOUtil.c:4497
0x080A3C39 Tcl_FSStat+233 at ./../generic/tclIOUtil.c:1449
0x080A38B2 Tcl_FSEvalFile+98 at
./../generic/tclIOUtil.c:1228
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CC62C (69 bytes) {realloc:3052:6}
[TclpRealloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|720]
0x080C77ED TclpRealloc+29 at ./../generic/tclAlloc.c:721
0x0806B1DD Tcl_AttemptRealloc+29 at
./../generic/tclCkalloc.c:1130
0x0805AE49 Tcl_AttemptSetObjLength+105 at
./../generic/tclStringObj.c:840
0x0805B428 AppendUtfToUtfRep+104 at
./../generic/tclStringObj.c:1336
0x0805B02B Tcl_AppendToObj+139 at
./../generic/tclStringObj.c:983
0x08094F72 TclpNativeJoinPath+146 at
./../generic/tclFileName.c:1101
0x080A4A49 Tcl_FSJoinPath+393 at
./../generic/tclIOUtil.c:2854
0x080A3375 FSNormalizeAbsolutePath+277 at
./../generic/tclIOUtil.c:889
0x080A5A16 Tcl_FSGetNormalizedPath+182 at
./../generic/tclIOUtil.c:3982
0x080A5E69 Tcl_FSGetFileSystemForPath+57 at
./../generic/tclIOUtil.c:4497
0x080A3C39 Tcl_FSStat+233 at ./../generic/tclIOUtil.c:1449
0x080A38B2 Tcl_FSEvalFile+98 at
./../generic/tclIOUtil.c:1228
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CC674 (24 bytes) {malloc:3062:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x080A5265 SetFsPathFromAbsoluteNormalized+149 at
./../generic/tclIOUtil.c:3482
0x080A338A FSNormalizeAbsolutePath+298 at
./../generic/tclIOUtil.c:909
0x080A5A16 Tcl_FSGetNormalizedPath+182 at
./../generic/tclIOUtil.c:3982
0x080A5E69 Tcl_FSGetFileSystemForPath+57 at
./../generic/tclIOUtil.c:4497
0x080A3C39 Tcl_FSStat+233 at ./../generic/tclIOUtil.c:1449
0x080A38B2 Tcl_FSEvalFile+98 at
./../generic/tclIOUtil.c:1228
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CDD64 (24 bytes) {malloc:2913:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x080A5609 SetFsPathFromAny+857 at
./../generic/tclIOUtil.c:3660
0x080553A5 Tcl_ConvertToType+37 at ./../generic/tclObj.c:473
0x080A514B Tcl_FSConvertToPathType+91 at
./../generic/tclIOUtil.c:3398
0x080A58EE Tcl_FSGetTranslatedPath+30 at
./../generic/tclIOUtil.c:3873
0x080A3875 Tcl_FSEvalFile+37 at
./../generic/tclIOUtil.c:1221
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CDF9C (16 bytes) {malloc:2911:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x0805B859 SetStringFromAny+89 at
./../generic/tclStringObj.c:1706
0x0805AD34 Tcl_SetObjLength+52 at
./../generic/tclStringObj.c:754
0x08094F9E TclpNativeJoinPath+190 at
./../generic/tclFileName.c:1112
0x080A4A49 Tcl_FSJoinPath+393 at
./../generic/tclIOUtil.c:2854
0x08094EB8 Tcl_FSJoinToPath+88 at
./../generic/tclFileName.c:1044
0x080A55FD SetFsPathFromAny+845 at
./../generic/tclIOUtil.c:3650
0x080553A5 Tcl_ConvertToType+37 at ./../generic/tclObj.c:473
0x080A514B Tcl_FSConvertToPathType+91 at
./../generic/tclIOUtil.c:3398
0x080A58EE Tcl_FSGetTranslatedPath+30 at
./../generic/tclIOUtil.c:3873
0x080A3875 Tcl_FSEvalFile+37 at
./../generic/tclIOUtil.c:1221
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

0x081CE0F8 (11 bytes) {malloc:2912:0}
[TclpAlloc|/home/tmp/tcltk/tcl8.4a4/unix/./../generic/tclAlloc.c|672]
0x080C77A9 TclpAlloc+25 at ./../generic/tclAlloc.c:673
0x0806B03B Tcl_Alloc+27 at ./../generic/tclCkalloc.c:1002
0x0805AD7A Tcl_SetObjLength+122 at
./../generic/tclStringObj.c:768
0x08094F9E TclpNativeJoinPath+190 at
./../generic/tclFileName.c:1112
0x080A4A49 Tcl_FSJoinPath+393 at
./../generic/tclIOUtil.c:2854
0x08094EB8 Tcl_FSJoinToPath+88 at
./../generic/tclFileName.c:1044
0x080A55FD SetFsPathFromAny+845 at
./../generic/tclIOUtil.c:3650
0x080553A5 Tcl_ConvertToType+37 at ./../generic/tclObj.c:473
0x080A514B Tcl_FSConvertToPathType+91 at
./../generic/tclIOUtil.c:3398
0x080A58EE Tcl_FSGetTranslatedPath+30 at
./../generic/tclIOUtil.c:3873
0x080A3875 Tcl_FSEvalFile+37 at
./../generic/tclIOUtil.c:1221
0x08054853 Tcl_Main+563 at ./../generic/tclMain.c:302
0x080544E4 main+36 at ./../unix/tclAppInit.c:101
0x400D2313 getpwent+51 at ../nss/getXXent.c:80
0x08054421 _start+33

Discussion

  • Don Porter

    Don Porter - 2002-04-14
    • assigned_to: hobbs --> dgp
    • labels: 105679 --> 105684
     
  • Don Porter

    Don Porter - 2002-04-20

    Logged In: YES
    user_id=80530

    committed fix for the TclSetStartupScriptPath "leak".

    Assigning to Vince; many of the remaining problems
    in this report appear to be in the VFS code.

     
  • Don Porter

    Don Porter - 2002-04-20
    • assigned_to: dgp --> vincentdarley
    • labels: 105684 --> 104242
     
  • Vince Darley

    Vince Darley - 2002-04-22

    Logged In: YES
    user_id=32170

    It's not clear to me what the 'remaining problems' are.
    All of the vfs-related ones seem to me to be leaks at
    tclMain.c:line 302, which is 'TclGetStartupScriptPath()', I
    think.

    Can 'rolf' or someone else perhaps provide some new
    traces. Else I don't really know what to look at, at all.

     
  • Vince Darley

    Vince Darley - 2002-05-07

    Logged In: YES
    user_id=32170

    My impression is that all of the above have been fixed.

     
  • Vince Darley

    Vince Darley - 2002-05-07
    • status: open --> closed-fixed
     
  • Rolf Ade

    Rolf Ade - 2002-05-09

    Logged In: YES
    user_id=13222

    I rechecked this, with the current HEAD (this is May 08
    22:00: GMT 2002). Configuration the same:

    ./configure --enable-symbols --disable-shared

    and -DPURIFY added to the C Flags.

    I'll append the results.

    Jeff noted, that he knows about the encoding ones.
    Three others are, "that looks like Vince's dept" (Jeff).

    rolf

    top 1 unfreed memory entry in leak table:

    bytes count location
    -------- ------ --------
    3464 8
    /home/rolf/tcltk/cvs/tcl/unix/./../generic/tclAlloc.c line 679
    3464 8 total

    0x0814D3D4 (10 bytes) {malloc:589:0}
    [TclpAlloc|/home/rolf/tcltk/cvs/tcl/unix/./../generic/tclAlloc.c|679]
    0x0810F509 TclpAlloc+25 at ./../generic/tclAlloc.c:679
    0x080746CC Tcl_Alloc+28 at ./../generic/tclCkalloc.c:1002
    0x0809F0FC Tcl_CreateEncoding+108 at
    ./../generic/tclEncoding.c:738
    0x080A0483 LoadTableEncoding+2179 at
    ./../generic/tclEncoding.c:1542
    0x0809FA03 LoadEncodingFile+483 at
    ./../generic/tclEncoding.c:1226
    0x0809EB8D Tcl_GetEncoding+141 at ./../generic/tclEncoding.c:418
    0x0809F03D Tcl_SetSystemEncoding+77 at
    ./../generic/tclEncoding.c:677
    0x0806AFDF TclpSetInitialEncodings+575 at
    ./../unix/tclUnixInit.c:572
    0x080A1EB9 TclFindEncodings+153 at
    ./../generic/tclEncoding.c:2806
    0x0809F790 Tcl_FindExecutable+160 at
    ./../generic/tclEncoding.c:1138
    0x08054757 Tcl_Main+55 at ./../generic/tclMain.c:227
    0x08054556 main+38 at ./../unix/tclAppInit.c:99
    0x400D2313 getpwent+51 at ../nss/getXXent.c:80
    0x08054491 _start+33

    0x0814D428 (268 bytes) {malloc:576:0}
    [TclpAlloc|/home/rolf/tcltk/cvs/tcl/unix/./../generic/tclAlloc.c|679]
    0x0810F509 TclpAlloc+25 at ./../generic/tclAlloc.c:679
    0x080746CC Tcl_Alloc+28 at ./../generic/tclCkalloc.c:1002
    0x0809FD06 LoadTableEncoding+262 at
    ./../generic/tclEncoding.c:1389
    0x0809FA03 LoadEncodingFile+483 at
    ./../generic/tclEncoding.c:1226
    0x0809EB8D Tcl_GetEncoding+141 at ./../generic/tclEncoding.c:418
    0x0809F03D Tcl_SetSystemEncoding+77 at
    ./../generic/tclEncoding.c:677
    0x0806AFDF TclpSetInitialEncodings+575 at
    ./../unix/tclUnixInit.c:572
    0x080A1EB9 TclFindEncodings+153 at
    ./../generic/tclEncoding.c:2806
    0x0809F790 Tcl_FindExecutable+160 at
    ./../generic/tclEncoding.c:1138
    0x08054757 Tcl_Main+55 at ./../generic/tclMain.c:227
    0x08054556 main+38 at ./../unix/tclAppInit.c:99
    0x400D2313 getpwent+51 at ../nss/getXXent.c:80
    0x08054491 _start+33

    0x0814D534 (1536 bytes) {malloc:579:0}
    [TclpAlloc|/home/rolf/tcltk/cvs/tcl/unix/./../generic/tclAlloc.c|679]
    0x0810F509 TclpAlloc+25 at ./../generic/tclAlloc.c:679
    0x080746CC Tcl_Alloc+28 at ./../generic/tclCkalloc.c:1002
    0x0809FD58 LoadTableEncoding+344 at
    ./../generic/tclEncoding.c:1401
    0x0809FA03 LoadEncodingFile+483 at
    ./../generic/tclEncoding.c:1226
    0x0809EB8D Tcl_GetEncoding+141 at ./../generic/tclEncoding.c:418
    0x0809F03D Tcl_SetSystemEncoding+77 at
    ./../generic/tclEncoding.c:677
    0x0806AFDF TclpSetInitialEncodings+575 at
    ./../unix/tclUnixInit.c:572
    0x080A1EB9 TclFindEncodings+153 at
    ./../generic/tclEncoding.c:2806
    0x0809F790 Tcl_FindExecutable+160 at
    ./../generic/tclEncoding.c:1138
    0x08054757 Tcl_Main+55 at ./../generic/tclMain.c:227
    0x08054556 main+38 at ./../unix/tclAppInit.c:99
    0x400D2313 getpwent+51 at ../nss/getXXent.c:80
    0x08054491 _start+33

    0x081C2578 (36 bytes) {malloc:590:0}
    [TclpAlloc|/home/rolf/tcltk/cvs/tcl/unix/./../generic/tclAlloc.c|679]
    0x0810F509 TclpAlloc+25 at ./../generic/tclAlloc.c:679
    0x080746CC Tcl_Alloc+28 at ./../generic/tclCkalloc.c:1002
    0x0809F10B Tcl_CreateEncoding+123 at
    ./../generic/tclEncoding.c:740
    0x080A0483 LoadTableEncoding+2179 at
    ./../generic/tclEncoding.c:1542
    0x0809FA03 LoadEncodingFile+483 at
    ./../generic/tclEncoding.c:1226
    0x0809EB8D Tcl_GetEncoding+141 at ./../generic/tclEncoding.c:418
    0x0809F03D Tcl_SetSystemEncoding+77 at
    ./../generic/tclEncoding.c:677
    0x0806AFDF TclpSetInitialEncodings+575 at
    ./../unix/tclUnixInit.c:572
    0x080A1EB9 TclFindEncodings+153 at
    ./../generic/tclEncoding.c:2806
    0x0809F790 Tcl_FindExecutable+160 at
    ./../generic/tclEncoding.c:1138
    0x08054757 Tcl_Main+55 at ./../generic/tclMain.c:227
    0x08054556 main+38 at ./../unix/tclAppInit.c:99
    0x400D2313 getpwent+51 at ../nss/getXXent.c:80
    0x08054491 _start+33

    0x081C8908 (1536 bytes) {malloc:585:0}
    [TclpAlloc|/home/rolf/tcltk/cvs/tcl/unix/./../generic/tclAlloc.c|679]
    0x0810F509 TclpAlloc+25 at ./../generic/tclAlloc.c:679
    0x080746CC Tcl_Alloc+28 at ./../generic/tclCkalloc.c:1002
    0x080A00D5 LoadTableEncoding+1237 at
    ./../generic/tclEncoding.c:1466
    0x0809FA03 LoadEncodingFile+483 at
    ./../generic/tclEncoding.c:1226
    0x0809EB8D Tcl_GetEncoding+141 at ./../generic/tclEncoding.c:418
    0x0809F03D Tcl_SetSystemEncoding+77 at
    ./../generic/tclEncoding.c:677
    0x0806AFDF TclpSetInitialEncodings+575 at
    ./../unix/tclUnixInit.c:572
    0x080A1EB9 TclFindEncodings+153 at
    ./../generic/tclEncoding.c:2806
    0x0809F790 Tcl_FindExecutable+160 at
    ./../generic/tclEncoding.c:1138
    0x08054757 Tcl_Main+55 at ./../generic/tclMain.c:227
    0x08054556 main+38 at ./../unix/tclAppInit.c:99
    0x400D2313 getpwent+51 at ../nss/getXXent.c:80
    0x08054491 _start+33

    0x08215774 (24 bytes) {malloc:3067:0}
    [TclpAlloc|/home/rolf/tcltk/cvs/tcl/unix/./../generic/tclAlloc.c|679]
    0x0810F509 TclpAlloc+25 at ./../generic/tclAlloc.c:679
    0x080746CC Tcl_Alloc+28 at ./../generic/tclCkalloc.c:1002
    0x0805CE5C Tcl_NewStringObj+60 at ./../generic/tclStringObj.c:207
    0x080DBBDD Tcl_FSJoinPath+349 at ./../generic/tclIOUtil.c:2900
    0x080D9AB3 FSNormalizeAbsolutePath+323 at
    ./../generic/tclIOUtil.c:898
    0x080DADD8 Tcl_FSGetCwd+168 at ./../generic/tclIOUtil.c:1898
    0x080DD2B1 Tcl_FSGetNormalizedPath+145 at
    ./../generic/tclIOUtil.c:4055
    0x080DD95B Tcl_FSGetFileSystemForPath+75 at
    ./../generic/tclIOUtil.c:4557
    0x080DA639 Tcl_FSStat+345 at ./../generic/tclIOUtil.c:1457
    0x080DA14E Tcl_FSEvalFile+94 at ./../generic/tclIOUtil.c:1237
    0x080549B0 Tcl_Main+656 at ./../generic/tclMain.c:302
    0x08054556 main+38 at ./../unix/tclAppInit.c:99
    0x400D2313 getpwent+51 at ../nss/getXXent.c:80
    0x08054491 _start+33

    0x0821578C (24 bytes) {malloc:3080:0}
    [TclpAlloc|/home/rolf/tcltk/cvs/tcl/unix/./../generic/tclAlloc.c|679]
    0x0810F509 TclpAlloc+25 at ./../generic/tclAlloc.c:679
    0x080746CC Tcl_Alloc+28 at ./../generic/tclCkalloc.c:1002
    0x080DC897 SetFsPathFromAbsoluteNormalized+199 at
    ./../generic/tclIOUtil.c:3559
    0x080D9ADD FSNormalizeAbsolutePath+365 at
    ./../generic/tclIOUtil.c:917
    0x080DADD8 Tcl_FSGetCwd+168 at ./../generic/tclIOUtil.c:1898
    0x080DD2B1 Tcl_FSGetNormalizedPath+145 at
    ./../generic/tclIOUtil.c:4055
    0x080DD95B Tcl_FSGetFileSystemForPath+75 at
    ./../generic/tclIOUtil.c:4557
    0x080DA639 Tcl_FSStat+345 at ./../generic/tclIOUtil.c:1457
    0x080DA14E Tcl_FSEvalFile+94 at ./../generic/tclIOUtil.c:1237
    0x080549B0 Tcl_Main+656 at ./../generic/tclMain.c:302
    0x08054556 main+38 at ./../unix/tclAppInit.c:99
    0x400D2313 getpwent+51 at ../nss/getXXent.c:80
    0x08054491 _start+33

    0x08215B38 (30 bytes) {malloc:3077:0}
    [TclpAlloc|/home/rolf/tcltk/cvs/tcl/unix/./../generic/tclAlloc.c|679]
    0x0810F509 TclpAlloc+25 at ./../generic/tclAlloc.c:679
    0x080746CC Tcl_Alloc+28 at ./../generic/tclCkalloc.c:1002
    0x0805D469 Tcl_SetStringObj+185 at
    ./../generic/tclStringObj.c:707
    0x080F9300 TclpObjNormalizePath+448 at
    ./../unix/tclUnixFCmd.c:1732
    0x080D9BA0 TclNormalizeToUniquePath+96 at
    ./../generic/tclIOUtil.c:989
    0x080D9ACD FSNormalizeAbsolutePath+349 at
    ./../generic/tclIOUtil.c:911
    0x080DADD8 Tcl_FSGetCwd+168 at ./../generic/tclIOUtil.c:1898
    0x080DD2B1 Tcl_FSGetNormalizedPath+145 at
    ./../generic/tclIOUtil.c:4055
    0x080DD95B Tcl_FSGetFileSystemForPath+75 at
    ./../generic/tclIOUtil.c:4557
    0x080DA639 Tcl_FSStat+345 at ./../generic/tclIOUtil.c:1457
    0x080DA14E Tcl_FSEvalFile+94 at ./../generic/tclIOUtil.c:1237
    0x080549B0 Tcl_Main+656 at ./../generic/tclMain.c:302
    0x08054556 main+38 at ./../unix/tclAppInit.c:99
    0x400D2313 getpwent+51 at ../nss/getXXent.c:80
    0x08054491 _start+33

     
  • Vince Darley

    Vince Darley - 2002-05-09
    • status: closed-fixed --> open-accepted
     
  • Vince Darley

    Vince Darley - 2002-05-09

    Logged In: YES
    user_id=32170

    Re-opening, given new traces. I have to say, though, that
    I don't understand why a given code-path should leak memory
    if and only if it is called from Tcl_Main. The same bits
    of code are called thousands of times during standard Tcl
    execution without leaking anything.

    This means the problem may well be more of an 'init' issue
    and not therefore v. easy for me to solve. I will have a
    look though.

     
  • Nobody/Anonymous

    Logged In: NO

    I really don't understand the 'fs' problems here. Could
    you take a look at what the contents of
    tclStartupScriptPath are (and particularly the contents
    of '(FsPath*)(tclStartupScriptPath-
    >internalRep.otherValuePtr)'), before and after the final
    call to 'TclSetStartupScriptPath(NULL);' before exit?

     
  • Vince Darley

    Vince Darley - 2002-05-10

    Logged In: YES
    user_id=32170

    Ok, I understand it now. I've attached a patch which
    should fix the problem. The new FS code allocates a
    Tcl_Obj to contain the 'cwd', and it wasn't being freed.

    Assigning to Jeff to fix the remaining 'Encoding' problems.

     
  • Vince Darley

    Vince Darley - 2002-05-10
    • assigned_to: vincentdarley --> hobbs
     
  • Vince Darley

    Vince Darley - 2002-05-10

    Logged In: YES
    user_id=32170

    Attaching a better patch, which also releases any memory
    allocated for additional filesystems which may be
    registered.

     
  • Vince Darley

    Vince Darley - 2002-05-21

    Logged In: YES
    user_id=32170

    Note: the attached patch has now been committed. This
    means the current cvs head should only show the 'encoding'
    problems which Jeff is planning to deal with (I assume!)

     
  • Vince Darley

    Vince Darley - 2002-05-30
    • labels: 104242 --> 105686
     
  • Don Porter

    Don Porter - 2002-05-30
    • labels: 105686 --> 50. Embedding Support
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2003-02-18
    • status: open-accepted --> closed-out-of-date
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2003-02-18

    Logged In: YES
    user_id=72656

    These should all be corrected in the HEAD for 8.4.2.

     
  • Nobody/Anonymous

    Logged In: NO

    huh!