Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1cd76cc2d668d4cdc864d4eed2bd9feee975dd93
Ticket: 1603234fffffffffffffffffffffffffffffffff
Memory leak with thread::transfer
User & Date: nobody on 2006-11-26 15:21:00
Changes

  1. assignee changed to: "vasiljevic"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    I am developing project using Tcl + Thread (BitTorrent tracker). At first I tried to use model where main thread after accepting new connection (using 
    socket -server) transfers connection socket to free thread using thread::transfer. But testing of this model reveals slow memory leak (about 1Mb/5min with requests rate about 100 req/sec). Using Tcl memory debugging (Tcl and Thread built with --enable-symbols=mem) and memory command I found that memory leaks after each thread::transfer call. This observes on latest Tcl/Threads versions as well (tcl8.4.14 and thread2.6.5) compiled on Solaris 9/i386 using GCC 3.3.2.
    
    Is this a known issue ? Is thread::transfer requires some extra dealing with transferred filedescriptors before or after transfer ?
    
    This is a small test:
    
    #!/usr/local/bin/tclsh
    
    package require Thread
    
    proc transfer {channel} {
        global tid
    
        puts [memory info]
        thread::transfer $tid $channel
        thread::send -async $tid "close $channel"
    }
    
    proc accept {channel client_addr client_port} {
        after idle [list transfer $channel]
    }
    
    set tid [thread::create -joinable thread::wait]
    
    socket -server accept 9999
    
    thread::wait
    
    Field "current bytes allocated" increased by 32 bytes after each incoming connection.
    
    
  4. foundin changed to: "obsolete: 8.4.14"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "nobody"
  10. subsystem changed to: "80. Thread Package"
  11. title changed to: "Memory leak with thread::transfer"
  12. type changed to: "Bug"