Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3355113d73e435ec7e3aacc9c9d00c4250687fb8
Ticket: a3309d01dbb0f23c3cf717ace30d9663fa54735f
Leak in array when unsetting keys from a proc
User & Date: aspect on 2015-07-16 00:04:47
Changes

  1. icomment:
    Just playing around with this on the script level, I've been able to simplify the test to the attached memleak-bovine.tcl + meminfo.tcl.
    
    Output shows allocated bytes increasing by ~900 each 5 iterations, and (total mallocs-total frees) increasing by 25 - this all after the array is "full" and elements are being deleted.
    
    Note this test doesn't require [lappend].  The dependency on [unset myarray($key)] is genuine -- using [array unset myarray $key] fails to exhibit the leak.
    
    Other variations:
    
    1. moving the entire body of [doit] into the loop at global scope doesn't leak
    2. moving the body of [doit] into the loop and wrapping it in a proc leaks
    3. making myarray proc-local instead of global leaks
    
  2. login: "aspect"
  3. mimetype: "text/plain"
  4. username: "aspect"