Tcl Source Code

View Ticket
Login
Ticket UUID: 1084446
Title: memory problems in tcl HEAD
Type: Bug Version: obsolete: 8.5a3
Submitter: pointsman Created on: 2004-12-13 14:52:54
Subsystem: 10. Objects Assigned To: msofer
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-10-22 10:10:39
Resolution: Out of Date Closed By: msofer
    Closed on: 2005-10-22 03:10:39
Description:
Motivated by #1084111 (which was simply a by-product
from testing my extension angainst tcl HEAD), I did a
more rigorous mem check of the HEAD. I'm aware, that
this may have not so high priority at this stage of the
dev cicle. And sure it isn't optimal helpful to just
submit only mildly consolidated valgrind outputs with
possible several different problems at once. Therefore
this report is meant only informal (and should be
closed, after HEAD has moved substantial).

The following is on the base of tcl HEAD of 2004-12-13,
around 14:00 CET (ChangeLog at revision 1.2478).

I compiled with symbols enabled and with -DPURIFY.

make test run without complains.

I exported LD_LIBRARY_PATH and TCL_LIBRARY and then run
tcltest under valgrind (version 2.0.0). Called it with:

valgrind --leak-check=yes --num-callers=40
--trace-children=yes --logfile-fd=9
--leak-resolution=high  ./tcltest ./../tests/all.tcl
-notfile socket.test 9>valgrind1.out 1>&9

Observations:

Without -notfile socket.test, that hung for several
hours somewhere in socket.test without sign of any
activities, for unknown reason.

io-6.56 and io-13.6 failed in the run under valgrind,
but not for a simple ./tcltest call for unknown reason.


valgrind reported some problems, even invalid reads.
This are

Triggered a few times by encoding.test (and its childs):

==15470== Invalid read of size 4
==15470==    at 0x40288724: FreeEncoding
(../generic/tclEncoding.c:727)
==15470==    by 0x4028B2A0: EscapeFreeProc
(../generic/tclEncoding.c:2960)
==15470==    by 0x40288749: FreeEncoding
(../generic/tclEncoding.c:730)
==15470==    by 0x40288557:
TclFinalizeEncodingSubsystem (../generic/tclEncoding.c:551)
==15470==    by 0x4028CCAD: Tcl_Finalize
(../generic/tclEvent.c:900)
==15470==    by 0x4028CB6C: Tcl_Exit
(../generic/tclEvent.c:734)
==15470==    by 0x4025AB7A: Tcl_ExitObjCmd
(../generic/tclCmdAH.c:673)
==15470==    by 0x40254CAB: TclEvalObjvInternal
(../generic/tclBasic.c:3053)
==15470==    by 0x402557F5: Tcl_EvalEx
(../generic/tclBasic.c:3537)
==15470==    by 0x40255B21: Tcl_Eval
(../generic/tclBasic.c:3651)
==15470==    by 0x402BC6EF: Tcl_Main
(../generic/tclMain.c:654)
==15470==    by 0x804C995: main (tclAppInit.c:87)
==15470==    by 0x4035D8AD: __libc_start_main (in
/lib/libc.so.6)
==15470==    by 0x804C8C0: (within
/home/rolf/tcltk/core-develop/tcl-head/unix/tcltest)
==15470==    Address 0x41A40444 is 28 bytes inside a
block of size 36 free'd
==15470==    at 0x40027E4D: free (vg_replace_malloc.c:231)
==15470==    by 0x40251A83: TclpFree
(../generic/tclAlloc.c:708)
==15470==    by 0x40259541: Tcl_Free
(../generic/tclCkalloc.c:1176)
==15470==    by 0x40288781: FreeEncoding
(../generic/tclEncoding.c:736)
==15470==    by 0x40288557:
TclFinalizeEncodingSubsystem (../generic/tclEncoding.c:551)
==15470==    by 0x4028CCAD: Tcl_Finalize
(../generic/tclEvent.c:900)
==15470==    by 0x4028CB6C: Tcl_Exit
(../generic/tclEvent.c:734)
==15470==    by 0x4025AB7A: Tcl_ExitObjCmd
(../generic/tclCmdAH.c:673)
==15470==    by 0x40254CAB: TclEvalObjvInternal
(../generic/tclBasic.c:3053)
==15470==    by 0x402557F5: Tcl_EvalEx
(../generic/tclBasic.c:3537)
==15470==    by 0x40255B21: Tcl_Eval
(../generic/tclBasic.c:3651)
==15470==    by 0x402BC6EF: Tcl_Main
(../generic/tclMain.c:654)
==15470==    by 0x804C995: main (tclAppInit.c:87)
==15470==    by 0x4035D8AD: __libc_start_main (in
/lib/libc.so.6)
==15470==    by 0x804C8C0: (within
/home/rolf/tcltk/core-develop/tcl-head/unix/tcltest)
==15470== 
==15470== Invalid read of size 4
==15470==    at 0x4028872A: FreeEncoding
(../generic/tclEncoding.c:728)
==15470==    by 0x4028B2A0: EscapeFreeProc
(../generic/tclEncoding.c:2960)
==15470==    by 0x40288749: FreeEncoding
(../generic/tclEncoding.c:730)
==15470==    by 0x40288557:
TclFinalizeEncodingSubsystem (../generic/tclEncoding.c:551)
==15470==    by 0x4028CCAD: Tcl_Finalize
(../generic/tclEvent.c:900)
==15470==    by 0x4028CB6C: Tcl_Exit
(../generic/tclEvent.c:734)
==15470==    by 0x4025AB7A: Tcl_ExitObjCmd
(../generic/tclCmdAH.c:673)
==15470==    by 0x40254CAB: TclEvalObjvInternal
(../generic/tclBasic.c:3053)
==15470==    by 0x402557F5: Tcl_EvalEx
(../generic/tclBasic.c:3537)
==15470==    by 0x40255B21: Tcl_Eval
(../generic/tclBasic.c:3651)
==15470==    by 0x402BC6EF: Tcl_Main
(../generic/tclMain.c:654)
==15470==    by 0x804C995: main (tclAppInit.c:87)
==15470==    by 0x4035D8AD: __libc_start_main (in
/lib/libc.so.6)
==15470==    by 0x804C8C0: (within
/home/rolf/tcltk/core-develop/tcl-head/unix/tcltest)
==15470==    Address 0x41A40444 is 28 bytes inside a
block of size 36 free'd
==15470==    at 0x40027E4D: free (vg_replace_malloc.c:231)
==15470==    by 0x40251A83: TclpFree
(../generic/tclAlloc.c:708)
==15470==    by 0x40259541: Tcl_Free
(../generic/tclCkalloc.c:1176)
==15470==    by 0x40288781: FreeEncoding
(../generic/tclEncoding.c:736)
==15470==    by 0x40288557:
TclFinalizeEncodingSubsystem (../generic/tclEncoding.c:551)
==15470==    by 0x4028CCAD: Tcl_Finalize
(../generic/tclEvent.c:900)
==15470==    by 0x4028CB6C: Tcl_Exit
(../generic/tclEvent.c:734)
==15470==    by 0x4025AB7A: Tcl_ExitObjCmd
(../generic/tclCmdAH.c:673)
==15470==    by 0x40254CAB: TclEvalObjvInternal
(../generic/tclBasic.c:3053)
==15470==    by 0x402557F5: Tcl_EvalEx
(../generic/tclBasic.c:3537)
==15470==    by 0x40255B21: Tcl_Eval
(../generic/tclBasic.c:3651)
==15470==    by 0x402BC6EF: Tcl_Main
(../generic/tclMain.c:654)
==15470==    by 0x804C995: main (tclAppInit.c:87)
==15470==    by 0x4035D8AD: __libc_start_main (in
/lib/libc.so.6)
==15470==    by 0x804C8C0: (within
/home/rolf/tcltk/core-develop/tcl-head/unix/tcltest)

Note, that both have the same calling path and differ
only one line in tclEncoding.c; probably the same
problem spot.

There are also several different memory leaks reported.
For completeness sake (and better readable results,
damn SF web interface), I attach the complete output, I
got. 

Some notes, how to read: the starting ==xxxxx== are the
process numbers. Due to --trace-children=yes valgrind
option, all the processes spawned by the tcltest run
are watched by seperate valgrind calls, therefor the
cuples of start/end msgs from valgrind. To find the
test file, which triggered a certain memory problem
srcoll up als long als you see a line starting with a
tcl test suite file name e.g. (note the <==== mark): 
[...]
==15992== Reachable blocks (those to which a pointer
was found) are not shown.
==15992== To see them, rerun with: --show-reachable=yes
==15992== 
winPipe.test <======
==15993== Memcheck, a.k.a. Valgrind, a memory error
detector for x86-linux.
==15993== Copyright (C) 2002-2003, and GNU GPL'd, by
Julian Seward.
[...]

Not surprising, some problems seems to be reported
several times.
User Comments: pointsman added on 2004-12-13 22:01:41:

File Added - 112292: valgrind1.out.gz

Attachments: