OLD | NEW |
1 # 2007 March 24 | 1 # 2007 March 24 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 10 matching lines...) Expand all Loading... |
21 sqlite3_soft_heap_limit 0 | 21 sqlite3_soft_heap_limit 0 |
22 | 22 |
23 proc pager_cache_size {db} { | 23 proc pager_cache_size {db} { |
24 set bt [btree_from_db $db] | 24 set bt [btree_from_db $db] |
25 db_enter $db | 25 db_enter $db |
26 array set stats [btree_pager_stats $bt] | 26 array set stats [btree_pager_stats $bt] |
27 db_leave $db | 27 db_leave $db |
28 return $stats(page) | 28 return $stats(page) |
29 } | 29 } |
30 | 30 |
31 do_test cache-1.1 { | 31 if {[permutation] == ""} { |
32 pager_cache_size db | 32 do_test cache-1.1 { pager_cache_size db } {0} |
33 } {0} | 33 } |
34 | 34 |
35 do_test cache-1.2 { | 35 do_test cache-1.2 { |
36 execsql { | 36 execsql { |
37 PRAGMA auto_vacuum=OFF; | 37 PRAGMA auto_vacuum=OFF; |
38 CREATE TABLE abc(a, b, c); | 38 CREATE TABLE abc(a, b, c); |
39 INSERT INTO abc VALUES(1, 2, 3); | 39 INSERT INTO abc VALUES(1, 2, 3); |
40 } | 40 } |
41 pager_cache_size db | 41 pager_cache_size db |
42 } {2} | 42 } {2} |
43 | 43 |
44 # At one point, repeatedly locking and unlocking the cache was causing | 44 # At one point, repeatedly locking and unlocking the cache was causing |
45 # a resource leak of one page per repetition. The page wasn't actually | 45 # a resource leak of one page per repetition. The page wasn't actually |
46 # leaked, but would not be reused until the pager-cache was full (i.e. | 46 # leaked, but would not be reused until the pager-cache was full (i.e. |
47 # 2000 pages by default). | 47 # 2000 pages by default). |
48 # | 48 # |
49 # This tests that once the pager-cache is initialised, it can be locked | 49 # This tests that once the pager-cache is initialised, it can be locked |
50 # and unlocked repeatedly without internally allocating any new pages. | 50 # and unlocked repeatedly without internally allocating any new pages. |
51 # | 51 # |
52 set cache_size [pager_cache_size db] | 52 set cache_size [pager_cache_size db] |
53 for {set ii 0} {$ii < 10} {incr ii} { | 53 for {set ii 0} {$ii < 10} {incr ii} { |
54 | 54 |
55 do_test cache-1.3.$ii { | 55 do_test cache-1.3.$ii { |
56 execsql {SELECT * FROM abc} | 56 execsql {SELECT * FROM abc} |
57 pager_cache_size db | 57 pager_cache_size db |
58 } $::cache_size | 58 } $::cache_size |
59 | 59 |
60 } | 60 } |
61 sqlite3_soft_heap_limit $soft_limit | 61 sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit) |
62 | 62 |
63 finish_test | 63 finish_test |
OLD | NEW |