Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2e028452f9c98b66d3aaf1996801b5bc75e45528
Ticket: 1869989fffffffffffffffffffffffffffffffff
memory leak when using expr
User & Date: dgp on 2008-01-16 00:00:11
Changes

  1. icomment:
    Logged In: YES 
    user_id=80530
    Originator: NO
    
    
    1) No limit.  Yes, over time a program that creates many
       literals can grow in memory footprint.  This is nothing new.
    
    2) The fundamental reason is that you have failed to brace
       the expression.  This means every evaluation of [expr]
       is creating an expression string, parsing that expression
       string (which creates literals), and only then compiling
       and executing the bytecode.  A properly braced expression
       would parse and compile only one time, and let the changing
       contents of a variable produce changing expression results
       when executing the same bytecode again and again.
       Using [+] is more like a braced expression than an unbraced
       expression.  For this example, they produce (nearly?) the
       same bytecode.
    
    Although there's no bug here, it does raise the general question
    of literal lifetime which might be worth looking into.
    
    
  2. login: "dgp"
  3. mimetype: "text/plain"
  4. username: "dgp"