Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-06-30
20:44 • Closed ticket [1706058fff]: Possible Memory Leak (with Threads?) plus 7 othe... artifact: f758efbb5f user: vasiljevic
20:42 • Ticket [1706058fff]: 4 changes artifact: 943320adf8 user: vasiljevic
20:40 • Ticket [1706058fff]: 4 changes artifact: 6602199a4f user: vasiljevic
2007-06-11
04:18 • Ticket [1706058fff]: 2 changes artifact: d42244a87e user: hobbs
2007-04-24
01:21 • Ticket [1706058fff]: 4 changes artifact: 48fe108f51 user: rkeene
2007-04-23
18:14 • New ticket [1706058fff]. artifact: 64708928c7 user: rkeene

Possible Memory Leak (with Threads?)

Closed / Duplicate1706058fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 19 years ago
Descriptionplain2007-04-23 18:14:10
#! /home/rkeene/devel/spamgateway/work/tcl8.4.14/INST/bin/tclsh8.4
# This seems to leak memory if I do:
#    for i in `seq 1 3000`; do telnet localhost 8931 & done
# The more times I run the above loop, the larger the "RES" section for the process under "top" becomes.

package require Thread 2.6.5

set workers_idx 0
for {set i 0} {$i < 20} {incr i} {
lappend workers [thread::create {
proc HandleConnection_worker {sock addr port} {
close $sock
}

thread::wait
}]
}

proc HandleConnection {sock addr port} {
after idle [list _HandleConnection $sock $addr $port]
}

proc _HandleConnection {sock addr port} {
set tid [lindex $::workers $::workers_idx]

set ::workers_idx [expr ($::workers_idx + 1) % [llength $::workers]]

thread::transfer $tid $sock
thread::send -async $tid [list HandleConnection_worker $sock $addr $port]
}

socket -server HandleConnection 8931

thread::wait
rkeeneplain2007-04-24 01:21:15
Logged In: YES 
user_id=180948
Originator: YES

This occurs on Linux 2.6 with Tcl v8.4.14 and Threads v2.6.5
hobbs Ticket [1706058fff]: 2 changes [History diff]2007-06-11 04:18:24
vasiljevicplain2007-06-30 20:40:21
Logged In: YES 
user_id=95086
Originator: NO

I can comfirm this. Amount of leaked memory
is small and it appears only when transfering
the socket into the other thread.
vasiljevicplain2007-06-30 20:42:38
Logged In: YES 
user_id=95086
Originator: NO

I can comfirm this. Amount of leaked memory
is small and it appears only when transfering
the socket into the other thread.
vasiljevicplain2007-06-30 20:44:00
Logged In: YES 
user_id=95086
Originator: NO

Will close this one as being a duplicate of 
Bug #1603234.
Log in (anonymous is fine) to add a comment.