Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 80a06cad51d18231813fb92ccba30e10cb7fcd47
Ticket: 693564ffffffffffffffffffffffffffffffffff
tcmdPtr leaked in rename and execution traces
User & Date: msofer on 2003-02-26 11:52:27
Changes

  1. assignee changed to: "vincentdarley"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    The tcmdPtr structures alloced by rename and execution
    traces are leaked. To see this, define the script
    /tmp/trace1.tcl as
    
       proc foo {} {}
       trace add command foo rename traceCommand
       trace add execution foo enter traceCommand
       rename foo {}
       proc exit args {}
    
    (note that the last line is just for insuring a proper
    cleanup of the main interpreter, it has no impact on
    the effects discussed here).
    
    Now run that script through valgrind and see the
    reported leaks:
    
    [mig@mini unix]$ /opt/valgrind/bin/valgrind
    --leak-check=yes --num-callers=10
    --leak-resolution=high ./tclsh /tmp/trace1.tcl     
    ==29788== valgrind-1.0.0, a memory error detector for
    x86 GNU/Linux.
    ==29788== Copyright (C) 2000-2002, and GNU GPL'd, by
    Julian Seward.
    ==29788== Estimated CPU clock rate is 598 MHz
    ==29788== For more details, rerun with: -v
    ==29788== 
    ==29788== 
    ==29788== ERROR SUMMARY: 0 errors from 0 contexts
    (suppressed: 0 from 0)
    ==29788== malloc/free: in use at exit: 90 bytes in 2
    blocks.
    ==29788== malloc/free: 2277 allocs, 2275 frees, 185733
    bytes allocated.
    ==29788== For counts of detected errors, rerun with: -v
    ==29788== searching for pointers to 2 not-freed blocks.
    ==29788== checked 4591484 bytes.
    ==29788== 
    ==29788== definitely lost: 90 bytes in 2 blocks.
    ==29788== possibly lost:   0 bytes in 0 blocks.
    ==29788== still reachable: 0 bytes in 0 blocks.
    ==29788== 
    ==29788== 45 bytes in 1 blocks are definitely lost in
    loss record 1 of 2
    ==29788==    at 0x400467C4: malloc (vg_clientfuncs.c:100)
    ==29788==    by 0x80EDB61: TclpAlloc
    (./../generic/tclAlloc.c:679)
    ==29788==    by 0x8072FF1: Tcl_Alloc
    (./../generic/tclCkalloc.c:1002)
    ==29788==    by 0x8081E63: TclTraceExecutionObjCmd
    (./../generic/tclCmdMZ.c:3233)
    ==29788==    by 0x8081786: Tcl_TraceObjCmd
    (./../generic/tclCmdMZ.c:2980)
    ==29788==    by 0x806D9B1: TclEvalObjvInternal
    (./../generic/tclBasic.c:3081)
    ==29788==    by 0x806E5D3: Tcl_EvalEx
    (./../generic/tclBasic.c:3670)
    ==29788==    by 0x80BD37B: Tcl_FSEvalFile
    (./../generic/tclIOUtil.c:1421)
    ==29788==    by 0x8054C1D: Tcl_Main
    (./../generic/tclMain.c:292)
    ==29788==    by 0x80547EB: main (./../unix/tclAppInit.c:90)
    ==29788== 
    ==29788== 45 bytes in 1 blocks are definitely lost in
    loss record 2 of 2
    ==29788==    at 0x400467C4: malloc (vg_clientfuncs.c:100)
    ==29788==    by 0x80EDB61: TclpAlloc
    (./../generic/tclAlloc.c:679)
    ==29788==    by 0x8072FF1: Tcl_Alloc
    (./../generic/tclCkalloc.c:1002)
    ==29788==    by 0x808244B: TclTraceCommandObjCmd
    (./../generic/tclCmdMZ.c:3457)
    ==29788==    by 0x8081786: Tcl_TraceObjCmd
    (./../generic/tclCmdMZ.c:2980)
    ==29788==    by 0x806D9B1: TclEvalObjvInternal
    (./../generic/tclBasic.c:3081)
    ==29788==    by 0x806E5D3: Tcl_EvalEx
    (./../generic/tclBasic.c:3670)
    ==29788==    by 0x80BD37B: Tcl_FSEvalFile
    (./../generic/tclIOUtil.c:1421)
    ==29788==    by 0x8054C1D: Tcl_Main
    (./../generic/tclMain.c:292)
    ==29788==    by 0x80547EB: main (./../unix/tclAppInit.c:90)
    ==29788== 
    ==29788== LEAK SUMMARY:
    ==29788==    definitely lost: 90 bytes in 2 blocks.
    ==29788==    possibly lost:   0 bytes in 0 blocks.
    ==29788==    still reachable: 0 bytes in 0 blocks.
    ==29788== Reachable blocks (those to which a pointer
    was found) are not shown.
    ==29788== To see them, rerun with: --show-reachable=yes
    ==29788== 
    
    
  4. foundin changed to: "obsolete: 8.4.1.1"
  5. priority changed to: "8"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "msofer"
  9. subsystem changed to: "45. Parsing and Eval"
  10. title changed to: "tcmdPtr leaked in rename and execution traces"
  11. type changed to: "Bug"