summaryrefslogtreecommitdiffstats
path: root/tests/namespace.test
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2010-01-03 20:29:11 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2010-01-03 20:29:11 (GMT)
commit10428413079058e0f75d48d4f976493454730d0b (patch)
treedce88a02399c32caf6d59948227d30e00d697a4d /tests/namespace.test
parentd20cf874f1303bf21f722abb01c7d1f08a9dc251 (diff)
downloadtcl-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/namespace.test')
-rw-r--r--tests/namespace.test25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/namespace.test b/tests/namespace.test
index 5feaf91..889f945 100644
--- a/tests/namespace.test
+++ b/tests/namespace.test
@@ -11,13 +11,15 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: namespace.test,v 1.76 2009/01/09 15:00:27 dkf Exp $
+# RCS: @(#) $Id: namespace.test,v 1.77 2010/01/03 20:29:12 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
+testConstraint memory [llength [info commands memory]]
+
#
# REMARK: the tests for 'namespace upvar' are not done here. They are to be
# found in the file 'upvar.test'.
@@ -2853,6 +2855,27 @@ test namespace-53.10 {ensembles: nested rewrite} -setup {
1 {wrong # args: should be "ns v x z2 a2"}\
0 {2 v v2}}
+test namespace-54.1 {leak on namespace deletion} -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 {}
+ namespace delete $ns
+ set start $end
+ set end [getbytes]
+ }
+ set leakedBytes [expr {$end - $start}]
+} -cleanup {
+ rename getbytes {}
+ unset i ns start end
+} -result 0
+
# cleanup
catch {rename cmd1 {}}
catch {unset l}