-C Separate\sverbs\sof\ssqlite3_config()\sand\ssqlite3_db_config()\sinto\stheir\nown\snamespaces.\s\sAllow\sSQLITE3_DBCONFIG_LOOKASIDE\sto\sspecific\san\sexternal\nmemory\sbuffer.\s(CVS\s5536)
-D 2008-08-04T20:13:27
+C Add\sSQLITE_STATUS_PAGECACHE_SIZE\sand\sSQLITE_STATUS_SCRATCH_SIZE.\s(CVS\s5537)
+D 2008-08-05T17:53:23
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 2713ea64947be3b35f35d9a3158bb8299c90b019
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3
F src/loadext.c eb1fe4f44d7c8ff53fc0c6a4388ab79fbd34cd64
F src/main.c d750c6c0d381252851401f6ea2ee72185de005ed
-F src/malloc.c f0ad28008351cac2337ef502a3fdc8ffd3e5d9a9
+F src/malloc.c 22c68fc62f0c2df0f1deb8cd9a5ea968f995cac2
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd
F src/mem2.c 87381b143530cc377592e868bd548e881c2498a3
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
F src/select.c c1899b14f5eb3d3b71aeb02d541d6c5052ad3b70
F src/shell.c 4b835fe734304ac22a3385868cd3790c1e4f7aa1
-F src/sqlite.h.in 286cbb5e5bbe31949d4537f532e44a22a3d14184
+F src/sqlite.h.in 157cd9932c2747a6ef3cb091e006185f4f9105d3
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
F src/sqliteInt.h 685b9cf6537e59e4453269b43acb33c59b566346
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
-F src/status.c 8ad1f215934c5f5afb91df86e44dccff7ef3c1d0
+F src/status.c b39b4468fe97c7d26be2de052804887c099312e7
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
F src/tclsqlite.c ec46084184f033ba396a9ee7b5514b695083d0f3
F src/test1.c e503344d492584d3df31c959f2b14da112e536f4
F src/test_func.c df7ddd5abfc5c8d6cd3e36ae9ecb0c276b0e9039
F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
F src/test_loadext.c 97dc8800e46a46ed002c2968572656f37e9c0dd9
-F src/test_malloc.c 75f639a723e498a67c0ee68e81318c671388d1a3
+F src/test_malloc.c 49abbf5d9c71fb06cf7a7cf96f9b9a799b77a421
F src/test_md5.c 28209a4e2068711b5443c33104fe41f21d160071
F src/test_mutex.c d3422d9f60cc1330249d102e74b333f0d24a0cb6
F src/test_onefile.c 243157b10275251c5dc2d6619aee2ff9ae22379c
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
F test/lock4.test 09d97d52cae18fadfe631552af9880dac6b3ae90
F test/lock5.test f4eeb0400cf65c37f733cb3c74401136f8c46acd
-F test/lookaside.test 22a518a780de0797d428d2ed6de56828ee7b5544
+F test/lookaside.test 48846c5620a0d4529e53fcb9d2e0e8b028833c6a
F test/main.test 8d77c161757ef7d96eaff0413daa7120c3b316fe
F test/malloc.test 69f5bb5a13b24edb1322fc1f42894f9d2f6446b1
F test/malloc3.test 094f8195fe8e409bd4da0f1d769f7745faec62c8
F test/tclsqlite.test aa1781808502271feccfd24f9e2c0d2c1d7c496a
F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1
F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125
-F test/tester.tcl 160c759e7e0661eaf1b4c15395ca7c0614b03d55
+F test/tester.tcl 12fd8394caeb71f7d961707da8668756389bc9d3
F test/thread001.test 3fb08080e1fe84d1bb7ec7bbc9e13743a77e5bc5
F test/thread002.test ed9b800460df01e3cf9428ee11dc4e3f04b9b896
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P f167b2745d491a1adb2b6c869b2169cd6fa53af8
-R d131d66bc7d60253653f16ca16c768cd
+P 5dd865da5e787c10ef4c9e96647724bfab9dea01
+R ce2564d8ec0dc6375aa3480b9fe6e715
U drh
-Z d5dc59ad71fc51bae7a99c7ae5dfa84b
+Z 6fec2c40476962caef5feb67a58958a2
-5dd865da5e787c10ef4c9e96647724bfab9dea01
\ No newline at end of file
+c4e9b824062ba82a8db01cd82e3e681de1940208
\ No newline at end of file
**
** Memory allocation functions used throughout sqlite.
**
-** $Id: malloc.c,v 1.33 2008/08/01 16:31:14 drh Exp $
+** $Id: malloc.c,v 1.34 2008/08/05 17:53:23 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
sqlite3_mutex_leave(mem0.mutex);
i *= sqlite3Config.szScratch;
sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, 1);
+ sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
p = (void*)&((char*)sqlite3Config.pScratch)[i];
}
}
scratch_overflow:
if( sqlite3Config.bMemstat ){
sqlite3_mutex_enter(mem0.mutex);
+ sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
n = mallocWithAlarm(n, &p);
if( p ) sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, n);
sqlite3_mutex_leave(mem0.mutex);
i = mem0.aPageFree[--mem0.nPageFree];
sqlite3_mutex_leave(mem0.mutex);
i *= sqlite3Config.szPage;
+ sqlite3StatusSet(SQLITE_STATUS_PAGECACHE_SIZE, n);
sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_USED, 1);
p = (void*)&((char*)sqlite3Config.pPage)[i];
}
page_overflow:
if( sqlite3Config.bMemstat ){
sqlite3_mutex_enter(mem0.mutex);
+ sqlite3StatusSet(SQLITE_STATUS_PAGECACHE_SIZE, n);
n = mallocWithAlarm(n, &p);
if( p ) sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, n);
sqlite3_mutex_leave(mem0.mutex);
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
**
-** @(#) $Id: sqlite.h.in,v 1.386 2008/08/04 20:13:27 drh Exp $
+** @(#) $Id: sqlite.h.in,v 1.387 2008/08/05 17:53:23 drh Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
** this parameter. The amount returned is the sum of the allocation
** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>
**
+** <dt>SQLITE_STATUS_MALLOC_SIZE</dt>
+** <dd>This parameter records the largest memory allocation request
+** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their
+** internal equivalents). Only the value returned in the
+** *pHighwater parameter to [sqlite3_status()] is of interest.
+** The value written into the *pCurrent parameter is undefined.</dd>
+**
** <dt>SQLITE_STATUS_PAGECACHE_USED</dt>
** <dd>This parameter returns the number of pages used out of the
-** page cache buffer configured using [SQLITE_CONFIG_PAGECACHE]. The
+** [pagecache memory allocator] that was configured using
+** [SQLITE_CONFIG_PAGECACHE]. The
** value returned is in pages, not in bytes.</dd>
**
** <dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>
** <dd>This parameter returns the number of bytes of page cache
** allocation which could not be statisfied by the [SQLITE_CONFIG_PAGECACHE]
-** buffer and where forced to overflow to [sqlite3_malloc()].</dd>
+** buffer and where forced to overflow to [sqlite3_malloc()]. The
+** returned value includes allocations that overflowed because they
+** where too large (they were larger than the "sz" parameter to
+** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
+** no space was left in the page cache.</dd>
+**
+** <dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>
+** <dd>This parameter records the largest memory allocation request
+** handed to [pagecache memory allocator]. Only the value returned in the
+** *pHighwater parameter to [sqlite3_status()] is of interest.
+** The value written into the *pCurrent parameter is undefined.</dd>
**
** <dt>SQLITE_STATUS_SCRATCH_USED</dt>
** <dd>This parameter returns the number of allocations used out of the
-** scratch allocation lookaside buffer configured using
+** [scratch memory allocator] configured using
** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not
-** in bytes. Since a single thread may only have one allocation
+** in bytes. Since a single thread may only have one scratch allocation
** outstanding at time, this parameter also reports the number of threads
** using scratch memory at the same time.</dd>
**
** <dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
** <dd>This parameter returns the number of bytes of scratch memory
** allocation which could not be statisfied by the [SQLITE_CONFIG_SCRATCH]
-** buffer and where forced to overflow to [sqlite3_malloc()].</dd>
+** buffer and where forced to overflow to [sqlite3_malloc()]. The values
+** returned include overflows because the requested allocation was too
+** larger (that is, because the requested allocation was larger than the
+** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer
+** slots were available.
+** </dd>
**
-** <dt>SQLITE_STATUS_MALLOC_SIZE</dt>
+** <dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
-** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their
-** internal equivalents). The value of interest is return in the
-** *pHighwater parameter to [sqlite3_status()]. The value written
-** into the *pCurrent parameter is undefined.</dd>
+** handed to [scratch memory allocator]. Only the value returned in the
+** *pHighwater parameter to [sqlite3_status()] is of interest.
+** The value written into the *pCurrent parameter is undefined.</dd>
**
** <dt>SQLITE_STATUS_PARSER_STACK</dt>
** <dd>This parameter records the deepest parser stack. It is only
#define SQLITE_STATUS_SCRATCH_OVERFLOW 4
#define SQLITE_STATUS_MALLOC_SIZE 5
#define SQLITE_STATUS_PARSER_STACK 6
+#define SQLITE_STATUS_PAGECACHE_SIZE 7
+#define SQLITE_STATUS_SCRATCH_SIZE 8
/*
** CAPI3REF: Status Parameters for database connections {H17275} <H17200>
** This module implements the sqlite3_status() interface and related
** functionality.
**
-** $Id: status.c,v 1.6 2008/08/01 16:31:14 drh Exp $
+** $Id: status.c,v 1.7 2008/08/05 17:53:23 drh Exp $
*/
#include "sqliteInt.h"
** Variables in which to record status information.
*/
static struct {
- int nowValue[7]; /* Current value */
- int mxValue[7]; /* Maximum value */
+ int nowValue[9]; /* Current value */
+ int mxValue[9]; /* Maximum value */
} sqlite3Stat;
** This file contains code used to implement test interfaces to the
** memory allocation subsystem.
**
-** $Id: test_malloc.c,v 1.46 2008/08/04 20:13:27 drh Exp $
+** $Id: test_malloc.c,v 1.47 2008/08/05 17:53:24 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
int op;
} aOp[] = {
{ "SQLITE_STATUS_MEMORY_USED", SQLITE_STATUS_MEMORY_USED },
+ { "SQLITE_STATUS_MALLOC_SIZE", SQLITE_STATUS_MALLOC_SIZE },
{ "SQLITE_STATUS_PAGECACHE_USED", SQLITE_STATUS_PAGECACHE_USED },
{ "SQLITE_STATUS_PAGECACHE_OVERFLOW", SQLITE_STATUS_PAGECACHE_OVERFLOW },
+ { "SQLITE_STATUS_PAGECACHE_SIZE", SQLITE_STATUS_PAGECACHE_SIZE },
{ "SQLITE_STATUS_SCRATCH_USED", SQLITE_STATUS_SCRATCH_USED },
{ "SQLITE_STATUS_SCRATCH_OVERFLOW", SQLITE_STATUS_SCRATCH_OVERFLOW },
- { "SQLITE_STATUS_MALLOC_SIZE", SQLITE_STATUS_MALLOC_SIZE },
+ { "SQLITE_STATUS_SCRATCH_SIZE", SQLITE_STATUS_SCRATCH_SIZE },
{ "SQLITE_STATUS_PARSER_STACK", SQLITE_STATUS_PARSER_STACK },
};
Tcl_Obj *pResult;
#
# Tests for the lookaside memory allocator.
#
-# $Id: lookaside.test,v 1.3 2008/08/04 20:13:27 drh Exp $
+# $Id: lookaside.test,v 1.4 2008/08/05 17:53:24 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
catch sqlite3_config_error
} {0}
sqlite3_initialize
+
+finish_test
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
-# $Id: tester.tcl,v 1.133 2008/07/25 15:39:04 drh Exp $
+# $Id: tester.tcl,v 1.134 2008/08/05 17:53:24 drh Exp $
#
# What for user input before continuing. This gives an opportunity
#
proc show_memstats {} {
set x [sqlite3_status SQLITE_STATUS_MEMORY_USED 0]
- set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]]
+ set y [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0]
+ set val [format {now %10d max %10d max-size %10d} \
+ [lindex $x 1] [lindex $x 2] [lindex $y 2]]
puts "Memory used: $val"
set x [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0]
- set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]]
+ set y [sqlite3_status SQLITE_STATUS_PAGECACHE_SIZE 0]
+ set val [format {now %10d max %10d max-size %10d} \
+ [lindex $x 1] [lindex $x 2] [lindex $y 2]]
puts "Page-cache used: $val"
set x [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0]
set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]]
set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]]
puts "Scratch memory used: $val"
set x [sqlite3_status SQLITE_STATUS_SCRATCH_OVERFLOW 0]
- set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]]
+ set y [sqlite3_status SQLITE_STATUS_SCRATCH_SIZE 0]
+ set val [format {now %10d max %10d max-size %10d} \
+ [lindex $x 1] [lindex $x 2] [lindex $y 2]]
puts "Scratch overflow: $val"
ifcapable yytrackmaxstackdepth {
set x [sqlite3_status SQLITE_STATUS_PARSER_STACK 0]
set val [format { max %10d} [lindex $x 2]]
puts "Parser stack depth: $val"
}
- set x [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0]
- puts "Maximum alloc size: [lindex $x 2]"
}
# A procedure to execute SQL