Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: cd4fbfb60a684bd49bbcf2fa09597a630f1d58b0d1fa02d3b9368ecab5c2b38c
Ticket: ae09f6b190ceec31747572edb9f9be8bb03a592f
Mem leak in trunk
User & Date: pointsman on 2024-07-14 01:04:34
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    The commit https://core.tcl-lang.org/tcl/info/bacfccf1e2cbab78
    introduced a memory leak. While I understand the reasoning for
    [bacfccf1e2cbab78] I so far not understand why it had this unfortunate
    "side-effect".
    
    The builds I use for this are all made with -DPURIFY.
    
    I'll append the output of a "make valgrind" run with
    [95f9e8176ed0b552] - the parent commit of bacfccf1e2cbab78 - and the
    output of the same with current trunk as of writing ([08603ee649]).
    The output of "make valgrind" with [bacfccf1e2cbab78] looks similar to
    the one of [08603ee649] (current trunk).
    
    For a short verification you don't need the whole time consuming run
    of the test suite under valgrind. With [bacfccf1e2cbab78] and under
    linux 
    
    make valgrind TESTFLAGS='-file load.test'
    
    it returns (amongst more details)
    
        definitely lost: 80 bytes in 5 blocks
        indirectly lost: 176 bytes in 11 blocks
          possibly lost: 0 bytes in 0 blocks
        still reachable: 0 bytes in 0 blocks
             suppressed: 0 bytes in 0 blocks
    
    With [95f9e8176ed0b552] - the parent commit of bacfccf1e2cbab78 - and
    the same
    
    make valgrind TESTFLAGS='-file load.test'
    
    it returns
    
        HEAP SUMMARY:
            in use at exit: 0 bytes in 0 blocks
          total heap usage: 383,994 allocs, 383,994 frees, 43,997,079 bytes allocated
        
        All heap blocks were freed -- no leaks are possible
    
    This can easily be "exploited" by a script. Any Tcl 9 binary extension
    will do it (I'd suppose). In the example below I used tdom
    de5237af97f2c1c (trunk at the moment of writing this). Run (your moral
    equivalent) of
    
    load ./libtcl9tdom0.9.4.so
    while 1 {
        interp create childinterp
        load {} Tdom childinterp
        interp delete childinterp
    }
    
    with a [bacfccf1e2cbab78] tclsh and watch the process somewhat slowly
    but steady growing. If I run that script with a tclsh with the parent
    commit to that the process doesn't shows this. (At least with mem
    builds.) Neither do I see the problem with 8.6
    
  5. foundin changed to: "Tcl 9"
  6. is_private changed to: "0"
  7. login: "pointsman"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "4ca203a8e925aecdd9419645f936bccf18cd6ea7"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "pointsman"
  14. subsystem changed to: "- New Builtin Commands"
  15. title changed to: "Mem leak in trunk"
  16. type changed to: "Bug"