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 #***********************************************************************
12 # This file contains test cases for sqlite3_db_release_memory and
13 # the PRAGMA shrink_memory statement.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
19 unset -nocomplain baseline
22 PRAGMA cache_size = 2000;
24 INSERT INTO t1 VALUES(randomblob(1000000),1);
26 set ::baseline sqlite3_memory_used
27 sqlite3_db_release_memory db
28 expr {$::baseline > [sqlite3_memory_used]+500000}
31 set baseline [sqlite3_memory_used]
35 expr {$::baseline+500000 < [sqlite3_memory_used]}
38 set baseline [sqlite3_memory_used]
39 db eval {PRAGMA shrink_memory}
40 expr {$::baseline > [sqlite3_memory_used]+500000}