Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a86ed1e5b027a02ab5cfb744a7c211aa6b02f14a
Ticket: 3386417fffffffffffffffffffffffffffffffff
errorstack leaked on syntax error
User & Date: ferrieux on 2011-08-09 05:44:58
Changes

  1. icomment:
    OK, got it: what we are witnessing is a cycle in the reference graph. Indeed errorstack is special in that it records, as true references, all the command lines in the stack, including the [namespace eval x OFFENDINGSCRIPT]. As a consequence:
        - options(-errorstack) holds a reference to OFFENDINGSCRIPT
        - OFFENDINGSCRIPT's BC holds, as a literal, a reference to options()
    Cycle.
    
    So, the reason why TclCleanupByteCode is not called on the syntax error, is the above cycle.
    So the whole cycle gets unreachable, and valgrinds just selects one as "definitely lost" and the rest as "indirectly lost".
    
    The cure is simply to remove the (compile-time) errorstack from the options dict when processing a syntax error.
    Patch to follow. 
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"