Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: fab8bbf2c3b2f3eb67e9e6a3a88bbc09bacc5e41
Ticket: 1521416fffffffffffffffffffffffffffffffff
thread::release on win32 does not release all memory
User & Date: nobody on 2006-07-12 19:53:10
Changes

  1. assignee changed to: "vasiljevic"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    The original usenet posting - 
     All 5 messages in topic - view as tree
    
    From:[email protected] - view profile
    Date:Tues, Jul 11 2006 11:01 am
    Email: [email protected]
    Groups: comp.lang.tcl
    Not yet rated
    Rating: 
    show options
    
    Reply | Reply to Author | Forward | Print | Individual
    Message | Show original | Report Abuse | Find messages
    by this author
    
    I am running tcl 8.4 on Windows XP Pro 2002, SP2.
    The simple script below fails on thread::create right
    under 12,000
    iterations.
    
    Attempts to create any more threads fail in the same
    shell once a call
    to
    thread::create fails.
    Restarting tclsh and rerunning seems to work fine
    within the limits
    mentioned
    above.
    
    Would anyone know the reason this would fail?
    
    ---------------
    tclsh
    package require Thread
    set i 1
    while { 1 } {
      set id [thread::create]
      thread::release $id
      puts -nonewline " $i "
      flush stdout
      update
      incr i
    
    } 
    
    
    
    
    From:David Gravereaux - view profile
    Date:Wed, Jul 12 2006 12:17 pm
    Email: David Gravereaux <[email protected]>
    Groups: comp.lang.tcl
    Not yet rated
    Rating: 
    show options
    
    Reply | Reply to Author | Forward | Print | Individual
    Message | Show original | Report Abuse | Find messages
    by this author
    
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1
    
    joe,
    
    I ran your script this time and I see what's going on :)
    
    The Tclsh process runs out of virtual memory space! 
    Not committed
    memory..  True VM allocations.  I even tried the old
    fashioned way with
    thread::wait and thread::unwind that I personally know
    for a fact do not
    leak handles..  The issue is not a handle leak.  The
    issue is not
    committed memory (apparently), but it appears that for
    each thread
    created, a slice of VM is given to it permanently and
    that slice isn't
    recouped (though it appears to have been uncommitted).
    
    Joe, insert your script as a new bug.  There's
    something going on that's
    a bit deeper than proper handle management.
    
    the Old way (that has the same behavior):
    
    package require Thread
    set i 1
    while { 1 } {
      set id [thread::create {thread::wait}]
      thread::send -async $id {thread::unwind}
      puts -nonewline " $i "
      flush stdout
      update
      incr i
    
    }
    
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "80. Thread Package"
  10. title changed to:
    thread::release on win32 does not release all memory
    
  11. type changed to: "Bug"