-C Documentation\supdates.\s(CVS\s5511)
-D 2008-07-31T14:47:55
+C Change\sthe\sdefinition\sof\sSQLITE_CONFIG_PAGECACHE\sand\nSQLITE_CONFIG_SCRATCH\sto\somit\sthe\smagic\s"+4"\sin\sthe\sbuffer\ssize\ncalculation.\s(CVS\s5512)
+D 2008-07-31T17:16:05
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in bbb62eecc851379aef5a48a1bf8787eb13e6ec06
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/legacy.c 3635cc6a5889918086b3501de8287cbbecb55917
F src/loadext.c 9ab55455f59dce0ae6388952216a1505ce7f9d13
F src/main.c 70d285dce241ad8daa320f78b060edb73bba637e
-F src/malloc.c 9359e52a3e8519a0584d3c90335ca4a76b1d90a8
+F src/malloc.c b1a337e2b903cd78cd7e529e2706ecf1ad95473d
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd
F src/mem2.c 87381b143530cc377592e868bd548e881c2498a3
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
F src/select.c ef18af5624fc3189014e6b617a36562394740f91
F src/shell.c 4b835fe734304ac22a3385868cd3790c1e4f7aa1
-F src/sqlite.h.in 1980ef5f4f36ae986f3bf1d54ee322c967b69923
+F src/sqlite.h.in 30af3a002a0b672aaae8f4a5deb0a2e9a4b699af
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
F src/sqliteInt.h a4d6bcf383b1ff207f175f7e274a83d1283c73d7
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/test_func.c 94c4424ed9869ecf2e2132662a04581bbec016f6
F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
F src/test_loadext.c df8ab3a6481ddebbdf0d28ebac5d9e0790f7860f
-F src/test_malloc.c 398f670f29e2d0c7b7717e2ea6386693b29afa28
+F src/test_malloc.c 43668d9cb053be59eac02f42bd0ce6aa4a5f15c6
F src/test_md5.c 28209a4e2068711b5443c33104fe41f21d160071
F src/test_mutex.c d3422d9f60cc1330249d102e74b333f0d24a0cb6
F src/test_onefile.c 243157b10275251c5dc2d6619aee2ff9ae22379c
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P f94239933e6f93d9780178b6f9a6b14ca791716a
-R cac4b89ea15db49a51f5d5c6e563f0a7
+P e7fdd813ccdefab33aedbcf7f44e13b935dd3299
+R 0da2bc60a3b7ef28cf0581731b3646dc
U drh
-Z 1c663e3103bc4c56c4b3a3ae279ff2de
+Z f0ba0aa5b2784db3a79cd7c3deea3b55
-e7fdd813ccdefab33aedbcf7f44e13b935dd3299
\ No newline at end of file
+e7ed0fe640a39053009eac52a7f055b121750e57
\ No newline at end of file
**
** Memory allocation functions used throughout sqlite.
**
-** $Id: malloc.c,v 1.31 2008/07/29 14:29:07 drh Exp $
+** $Id: malloc.c,v 1.32 2008/07/31 17:16:05 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
if( sqlite3Config.pScratch && sqlite3Config.szScratch>=3000
&& sqlite3Config.nScratch>0 ){
int i;
+ sqlite3Config.szScratch -= 4;
mem0.aScratchFree = (u32*)&((char*)sqlite3Config.pScratch)
[sqlite3Config.szScratch*sqlite3Config.nScratch];
for(i=0; i<sqlite3Config.nScratch; i++){ mem0.aScratchFree[i] = i; }
sqlite3Config.szScratch = 0;
}
if( sqlite3Config.pPage && sqlite3Config.szPage>=512
- && sqlite3Config.nPage>0 ){
+ && sqlite3Config.nPage>1 ){
int i;
+ int overhead;
+ int sz = sqlite3Config.szPage;
+ int n = sqlite3Config.nPage;
+ overhead = (4*n + sz - 1)/sz;
+ sqlite3Config.nPage -= overhead;
mem0.aPageFree = (u32*)&((char*)sqlite3Config.pPage)
[sqlite3Config.szPage*sqlite3Config.nPage];
for(i=0; i<sqlite3Config.nPage; i++){ mem0.aPageFree[i] = i; }
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
**
-** @(#) $Id: sqlite.h.in,v 1.383 2008/07/31 14:47:55 drh Exp $
+** @(#) $Id: sqlite.h.in,v 1.384 2008/07/31 17:16:05 drh Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
** <li> [sqlite3_memory_used()]
** <li> [sqlite3_memory_highwater()]
** <li> [sqlite3_soft_heap_limit()]
-** <li> sqlite3_memory_status()
+** <li> [sqlite3_status()]
** </ul>
** </dd>
**
** <dd>This option specifies a static memory buffer that SQLite can use for
** scratch memory. There are three arguments: A pointer to the memory, the
** size of each scratch buffer (sz), and the number of buffers (N). The sz
-** argument must be a multiple of 16. The first
-** argument should point to an allocation of at least (sz+4)*N bytes of memory.
+** argument must be a multiple of 16. The sz parameter should be a few bytes
+** larger than the actual scratch space required due internal overhead.
+** The first
+** argument should point to an allocation of at least sz*N bytes of memory.
** SQLite will use no more than one scratch buffer at once per thread, so
** N should be set to the expected maximum number of threads. The sz
** parameter should be 6 times the size of the largest database page size.
** the database page cache. There are three arguments: A pointer to the
** memory, the size of each page buffer (sz), and the number of pages (N).
** The sz argument must be a power of two between 512 and 32768. The first
-** argument should point to an allocation of at least (sz+4)*N bytes of memory.
+** argument should point to an allocation of at least sz*N bytes of memory.
** SQLite will use the memory provided by the first argument to satisfy its
** memory needs for the first N pages that it adds to cache. If additional
** page cache memory is needed beyond what is provided by this option, then
-** SQLite goes to [sqlite3_malloc()] for the additional storage space.</dd>
+** SQLite goes to [sqlite3_malloc()] for the additional storage space.
+** The implementation might use one or more of the N buffers to hold
+** memory accounting information. </dd>
**
** <dt>SQLITE_CONFIG_HEAP</dt>
** <dd>This option specifies a static memory buffer that SQLite will use
**
** <dt>SQLITE_STATUS_PARSER_STACK</dt>
** <dd>This parameter records the deepest parser stack. It is only
-** meaningful if SQLite is compiled with YYTRACKMAXSTACKDEPTH.</dd>
+** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>
** </dl>
**
** New status parameters may be added from time to time.
** This file contains code used to implement test interfaces to the
** memory allocation subsystem.
**
-** $Id: test_malloc.c,v 1.43 2008/07/29 14:29:07 drh Exp $
+** $Id: test_malloc.c,v 1.44 2008/07/31 17:16:05 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
buf = 0;
rc = sqlite3_config(SQLITE_CONFIG_SCRATCH, 0, 0, 0);
}else{
- buf = malloc( (sz+4)*N );
+ buf = malloc( sz*N );
rc = sqlite3_config(SQLITE_CONFIG_SCRATCH, buf, sz, N);
}
pResult = Tcl_NewObj();
buf = 0;
rc = sqlite3_config(SQLITE_CONFIG_PAGECACHE, 0, 0, 0);
}else{
- buf = malloc( (sz+4)*N );
+ buf = malloc( sz*N );
rc = sqlite3_config(SQLITE_CONFIG_PAGECACHE, buf, sz, N);
}
pResult = Tcl_NewObj();