diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-09-21 09:36:35 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-09-21 09:36:35 (GMT) |
| commit | ae2f2b211d31070531913851b894e2665b544beb (patch) | |
| tree | f85bb98792c720e90346badc16cb7db5dd867027 /tests/var.test | |
| parent | 65d17884a3fc402968d737201112e8006e371434 (diff) | |
| parent | 3b786ffebeb7769d34099ea7064532501dc6aee5 (diff) | |
| download | tcl-winFixes.zip tcl-winFixes.tar.gz tcl-winFixes.tar.bz2 | |
merge core-8-6-branch. Undo changes to coffbase.txt (they cause overlap with Tk)winFixes
Diffstat (limited to 'tests/var.test')
| -rw-r--r-- | tests/var.test | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/var.test b/tests/var.test index 297034a..a9d93ac 100644 --- a/tests/var.test +++ b/tests/var.test @@ -26,6 +26,20 @@ testConstraint testupvar [llength [info commands testupvar]] testConstraint testgetvarfullname [llength [info commands testgetvarfullname]] testConstraint testsetnoerr [llength [info commands testsetnoerr]] testConstraint memory [llength [info commands memory]] +if {[testConstraint memory]} { + proc getbytes {} { + return [lindex [split [memory info] \n] 3 3] + } + proc leaktest {script {iterations 3}} { + set end [getbytes] + for {set i 0} {$i < $iterations} {incr i} { + uplevel 1 $script + set tmp $end + set end [getbytes] + } + return [expr {$end - $tmp}] + } +} catch {rename p ""} catch {namespace delete test_ns_var} @@ -579,6 +593,22 @@ test var-8.2 {TclDeleteNamespaceVars, "unset" traces on ns delete are called wit list [namespace delete test_ns_var] $::info } -result {{} {::test_ns_var::v {} u}} +test var-8.3 {TclDeleteNamespaceVars, mem leak} -constraints memory -setup { + proc ::t {a i o} { + set $a 321 + } +} -body { + leaktest { + namespace eval n { + variable v 123 + trace variable v u ::t + } + namespace delete n + } +} -cleanup { + rename ::t {} +} -result 0 + test var-9.1 {behaviour of TclGet/SetVar simple get/set} -setup { catch {unset u} catch {unset v} |
