summaryrefslogtreecommitdiffstats
path: root/tests/compExpr.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2008-01-16 21:54:32 (GMT)
committerdgp <dgp@users.sourceforge.net>2008-01-16 21:54:32 (GMT)
commit49eca9a7a4e39d17536afa4222fca7a529988b80 (patch)
treeff7af4bbc2f4ec827dccdc503d3dce088ffc0061 /tests/compExpr.test
parent6101ed5d08da556682f4d6c8870f87180eeef50a (diff)
downloadtcl-49eca9a7a4e39d17536afa4222fca7a529988b80.zip
tcl-49eca9a7a4e39d17536afa4222fca7a529988b80.tar.gz
tcl-49eca9a7a4e39d17536afa4222fca7a529988b80.tar.bz2
test for memory leak
Diffstat (limited to 'tests/compExpr.test')
-rw-r--r--tests/compExpr.test21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/compExpr.test b/tests/compExpr.test
index 341d88a..c3e68c1 100644
--- a/tests/compExpr.test
+++ b/tests/compExpr.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: compExpr.test,v 1.16 2007/12/13 15:26:06 dgp Exp $
+# RCS: @(#) $Id: compExpr.test,v 1.17 2008/01/16 21:54:33 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -342,6 +342,25 @@ test compExpr-7.1 {Memory Leak} -constraints memory -setup {
rename getbytes {}
} -result 0
+test compExpr-7.2 {[Bug 1869989]: expr parser memleak} -constraints memory -setup {
+ proc getbytes {} {
+ set lines [split [memory info] \n]
+ lindex $lines 3 3
+ }
+} -body {
+ set i 5
+ set end [getbytes]
+ while {[incr i -1]} {
+ expr ${i}000
+ set tmp $end
+ set end [getbytes]
+ }
+ set leakedBytes [expr {$end - $tmp}]
+} -cleanup {
+ unset end i tmp
+ rename getbytes {}
+} -result 0
+
# cleanup
catch {unset a}
catch {unset b}