From 49eca9a7a4e39d17536afa4222fca7a529988b80 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 16 Jan 2008 21:54:32 +0000 Subject: test for memory leak --- ChangeLog | 1 + tests/compExpr.test | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 182dede..2a0992c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ * generic/tclCompExpr.c: Fix literal leak in exprs [Bug 1869989] * generic/tclExecute.c: (dgp) + * tests/compExpr.test: * doc/proc.n: changed wording for access to non-local variables; added mention to [namespace upvar]. Lame attempt at dealing with 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} -- cgit v0.12