diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2010-01-03 20:29:11 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2010-01-03 20:29:11 (GMT) |
commit | 10428413079058e0f75d48d4f976493454730d0b (patch) | |
tree | dce88a02399c32caf6d59948227d30e00d697a4d /tests/coroutine.test | |
parent | d20cf874f1303bf21f722abb01c7d1f08a9dc251 (diff) | |
download | tcl-10428413079058e0f75d48d4f976493454730d0b.zip tcl-10428413079058e0f75d48d4f976493454730d0b.tar.gz tcl-10428413079058e0f75d48d4f976493454730d0b.tar.bz2 |
* generic/tclBasic.c: Fix lerak of coroutines on namespace
* generic/tclCompile.h: deletion, [Bug 2724403]. Added a test
* generic/tclNamesp.c: for this leak, and also a test for
* tests/coroutine.test: leaks on namespace deletion.
* tests/namespace.test:
Diffstat (limited to 'tests/coroutine.test')
-rw-r--r-- | tests/coroutine.test | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/coroutine.test b/tests/coroutine.test index b4019d4..caa1d0a 100644 --- a/tests/coroutine.test +++ b/tests/coroutine.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: coroutine.test,v 1.10 2009/12/19 14:22:00 msofer Exp $ +# RCS: @(#) $Id: coroutine.test,v 1.11 2010/01/03 20:29:12 msofer Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -17,6 +17,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { } testConstraint testnrelevels [llength [info commands testnrelevels]] +testConstraint memory [llength [info commands memory]] set lambda [list {{start 0} {stop 10}} { # init @@ -378,6 +379,7 @@ test coroutine-4.2 {bug #2093188} -setup { rename bar {} unset ::res } -result {{} 3 {{v {} read} {v {} unset}}} + test coroutine-4.3 {bug #2093947} -setup { proc foo {} { set v 1 @@ -412,6 +414,29 @@ test coroutine-4.4 {bug #2917627: cmd resolution} -setup { namespace delete b } -result local +test coroutine-4.5 {bug #2724403} -constraints {memory} \ +-setup { + proc getbytes {} { + set lines [split [memory info] "\n"] + lindex $lines 3 3 + } +} -body { + set end [getbytes] + for {set i 0} {$i < 5} {incr i} { + set ns ::y$i + namespace eval $ns {} + proc ${ns}::start {} {yield; puts hello} + coroutine ${ns}::run ${ns}::start + namespace delete $ns + set start $end + set end [getbytes] + } + set leakedBytes [expr {$end - $start}] +} -cleanup { + rename getbytes {} + unset i ns start end +} -result 0 + test coroutine-5.1 {right numLevels on coro return} -constraints {testnrelevels} \ -setup { proc nestedYield {{val {}}} { |