3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing that the VACUUM statement correctly
13 # frees any memory used for a temporary cache.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 set testprefix vacuummem
20 if {[permutation]=="memsubsys1"} {
27 set stat [sqlite3_status SQLITE_STATUS_MEMORY_USED 1]
32 PRAGMA cache_size = -2000;
33 CREATE TABLE t1(a, b, c);
36 SELECT 1 UNION ALL SELECT i+1 FROM r WHERE i<100000
38 INSERT INTO t1 SELECT randomblob(100),randomblob(100),randomblob(100) FROM r;
40 CREATE INDEX t1a ON t1(a);
41 CREATE INDEX t1b ON t1(b);
42 CREATE INDEX t1c ON t1(c);
44 set ans "#/[memory_used]/"
46 do_test 1.1 { memory_used } $ans
48 do_execsql_test 1.2 VACUUM
50 do_test 1.3 { memory_used } $ans
53 SELECT count(*) FROM t1 WHERE +a IS NOT NULL
56 do_test 1.5 { memory_used } $ans