Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: fdfdf224bbd5c71726c3f88b662dd5d6286d959e3bdc7a56770fcbc80c038d19
Ticket: c58729527114216540ced9f26d1e3afd602f9410
Valgrind shows small memory leak after TIP 720 merge
User & Date: dkf on 2025-06-20 16:03:40
Changes

  1. icomment:
    Should be fixed.
    
    The actual deallocator is in `tclCompCmdsSZ.c` (it's `FreeJumptableInfo`) but isn't itself interesting, just as `AllocJumptable` isn't interesting. The problem was exactly that it was not being called when the compilation environment was reset after a failed assemble (which was necessary because without the reset I was getting crashes with something else going wonky; I forget exactly what but it was horrible). The problem was I'd got the reset wrong; I wasn't deleting the no-longer-desired aux data structures during the reset process. My fix adds that in.
    
    I found the problem by adding `printf()` calls into the jumptable allocator and deallocator functions and going through the tests in `assemble.test`; the sole characteristic factor was a failure in the assembly generation after the (local) success of the `jumpTable` instruction. It was a little noisy matching up allocation addresses. I then remembered that I'd done something with resetting the compilation environment (which _isn't_ owned by the `assemble` command) on error.
    
    ---
    Also note that `assemble` is special in needing this reset; other commands use a strategy in `tclCompile.c` of falling back to their interpreted versions, but `assemble` basically doesn't have that option. It can only work in compiled mode.
    
  2. login: "dkf"
  3. mimetype: "text/x-markdown"