-C Change\smem5.c\sso\sthat\sthe\sminimum\sallocation\ssize\sis\sruntime\sconfigurable.\s(CVS\s5320)
-D 2008-06-27T13:27:04
+C Fix\smem3.c\s(broken\sby\s(5320)).\s(CVS\s5321)
+D 2008-06-27T14:05:25
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
F src/mem1.c 8340fa5f969e9f9b9bdeb54106457a2003456d2b
F src/mem2.c 23f9538f35fbcd5665afe7056a56be0c7ed65aa7
-F src/mem3.c 8d34a22617a0eb96c05a83fc2c4fbbaed6bcfde1
+F src/mem3.c abaf65e3fa911b8acdbb67a50a54ec149af55736
F src/mem4.c 6703adb1717b26d9d70a1c2586b4b7b7ffee7909
-F src/mem5.c 2ad92d6aa224650f9fa9ad41fbf27b6cdae8a76f
+F src/mem5.c 6c711af220f2c1566724dc439a34a98f94ab01a0
F src/mutex.c a485a0eac8ee2cd95f66e565b4c6696c18db968f
F src/mutex.h e52ffa1dfc6a6077e8b1823d2c2b7dfcbcf85594
F src/mutex_os2.c 9c5637aa4c307c552566d0f0b3bd206245b54a97
F src/shell.c 479807b87f0409289eec4a776cd6ae56d30544b1
F src/sqlite.h.in bcdf4f68ce70ca30f0c3d351858383ce398e3c66
F src/sqlite3ext.h 7bf1651c6fb7183831e5113b4b91662bbe67e5bf
-F src/sqliteInt.h a3d505360be0385fdd6d02fef82f3f10e952259e
+F src/sqliteInt.h 35e420ced9e27af5ee387cd40f2e7a431665f858
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 6cb10377992505bd69f1ca1d75c1240a65f25a58
F src/table.c 1fa8f8113ac9cbc09ae4801c6d2a7f0af82c5822
F src/test_func.c f4aafa10f17d52c43a64b47717265802e6e552b3
F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
F src/test_loadext.c df8ab3a6481ddebbdf0d28ebac5d9e0790f7860f
-F src/test_malloc.c 68da4add2f3f5f2aace5a15122df80e5f8454af4
+F src/test_malloc.c 62296810d3ee914fc3e05f2a8a69d8f8f42c32e1
F src/test_md5.c 28209a4e2068711b5443c33104fe41f21d160071
F src/test_mutex.c b1433eb96520656fb3e4a218253a94ac32bd5775
F src/test_onefile.c 243157b10275251c5dc2d6619aee2ff9ae22379c
F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
F test/pageropt.test 6df72c441db0a037b7ec6990d16311c24fbea77b
F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e
-F test/permutations.test 17aa068f5f6612a9e91ec316463f94141436445a
+F test/permutations.test af83024a469d1cade2a6ca9ce33e61bcdd7c2672
F test/pragma.test 44bc52afa72cabfeae82641e0033ca24919f3ce8
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
F test/printf.test c3405535b418d454e8a52196a0fc592ec9eec58d
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 0b01ec5cf7725a02d4c12167df125cef578f6219
-R 0a2d2902a0d1d00bcf1712dac8ab54a9
+P 4f95f4cdf77e134fab42148e10198c7b008d4ae6
+R 63274e6bfa4b3133971620ba2cd4bf5a
U danielk1977
-Z 48c1b0881009fcf3cbbdeacd5d1ca6e8
+Z 6121d4e53f8a4f4f8796267fc367b534
-4f95f4cdf77e134fab42148e10198c7b008d4ae6
\ No newline at end of file
+fef90a21aea11f15371d3fcf44548d786dd8819b
\ No newline at end of file
** This version of the memory allocation subsystem is included
** in the build only if SQLITE_ENABLE_MEMSYS3 is defined.
**
-** $Id: mem3.c,v 1.17 2008/06/25 14:57:54 danielk1977 Exp $
+** $Id: mem3.c,v 1.18 2008/06/27 14:05:25 danielk1977 Exp $
*/
#include "sqliteInt.h"
** Initialize this module.
*/
static int memsys3Init(void *NotUsed){
+ if( !sqlite3Config.pHeap ){
+ return SQLITE_ERROR;
+ }
+
+ /* Store a pointer to the memory block in global structure mem3. */
+ assert( sizeof(Mem3Block)==8 );
+ mem3.aPool = (Mem3Block *)sqlite3Config.pHeap;
+ mem3.nPool = (sqlite3Config.nHeap / sizeof(Mem3Block)) - 2;
+
+ /* Initialize the master block. */
+ mem3.szMaster = mem3.nPool;
+ mem3.mnMaster = mem3.szMaster;
+ mem3.iMaster = 1;
+ mem3.aPool[0].u.hdr.size4x = (mem3.szMaster<<2) + 2;
+ mem3.aPool[mem3.nPool].u.hdr.prevSize = mem3.nPool;
+ mem3.aPool[mem3.nPool].u.hdr.size4x = 1;
+
return SQLITE_OK;
}
** This routine is only called by sqlite3_config(), and therefore
** is not required to be threadsafe (it is not).
*/
-void sqlite3MemSetMemsys3(u8 *pBlock, int nBlock){
+const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){
static const sqlite3_mem_methods mempoolMethods = {
memsys3Malloc,
memsys3Free,
memsys3Shutdown,
0
};
-
- /* Configure the functions to call to allocate memory. */
- sqlite3_config(SQLITE_CONFIG_MALLOC, &mempoolMethods);
-
- /* Store a pointer to the memory block in global structure mem3. */
- assert( sizeof(Mem3Block)==8 );
- mem3.aPool = (Mem3Block *)pBlock;
- mem3.nPool = (nBlock / sizeof(Mem3Block)) - 2;
-
- /* Initialize the master block. */
- mem3.szMaster = mem3.nPool;
- mem3.mnMaster = mem3.szMaster;
- mem3.iMaster = 1;
- mem3.aPool[0].u.hdr.size4x = (mem3.szMaster<<2) + 2;
- mem3.aPool[mem3.nPool].u.hdr.prevSize = mem3.nPool;
- mem3.aPool[mem3.nPool].u.hdr.size4x = 1;
+ return &mempoolMethods;
}
#endif /* SQLITE_ENABLE_MEMSYS3 */
** This version of the memory allocation subsystem is included
** in the build only if SQLITE_ENABLE_MEMSYS5 is defined.
**
-** $Id: mem5.c,v 1.9 2008/06/27 13:27:04 danielk1977 Exp $
+** $Id: mem5.c,v 1.10 2008/06/27 14:05:25 danielk1977 Exp $
*/
#include "sqliteInt.h"
int nMinLog; /* Log of minimum allocation size in bytes*/
int iOffset;
+ if( !zByte ){
+ return SQLITE_ERROR;
+ }
+
nMinLog = memsys5Log(sqlite3Config.mnReq);
mem5.nAtom = (1<<nMinLog);
while( sizeof(Mem5Link)>mem5.nAtom ){
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.733 2008/06/27 13:27:04 danielk1977 Exp $
+** @(#) $Id: sqliteInt.h,v 1.734 2008/06/27 14:05:25 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
void *sqlite3PageMalloc(int);
void sqlite3PageFree(void*);
void sqlite3MemSetDefault(void);
-void sqlite3MemSetMemsys3(u8 *pBlock, int nBlock);
const sqlite3_mem_methods *sqlite3MemGetMemsys5(void);
+const sqlite3_mem_methods *sqlite3MemGetMemsys3(void);
void sqlite3BenignMallocHooks(void (*)(void), void (*)(void));
#ifndef SQLITE_MUTEX_NOOP
** This file contains code used to implement test interfaces to the
** memory allocation subsystem.
**
-** $Id: test_malloc.c,v 1.32 2008/06/27 13:27:04 danielk1977 Exp $
+** $Id: test_malloc.c,v 1.33 2008/06/27 14:05:25 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
return TCL_OK;
}
-/*
-** Usage:
-**
-** sqlite3_config_memsys3 NBYTE
-** sqlite3_config_memsys5 NBYTE
-**
-*/
-static int test_config_memsys3(
- void * clientData,
- Tcl_Interp *interp,
- int objc,
- Tcl_Obj *CONST objv[]
-){
- int sz, rc;
- static char buf[1048576];
- if( objc!=2 ){
- Tcl_WrongNumArgs(interp, 1, objv, "NBYTE");
- return TCL_ERROR;
- }
- if( Tcl_GetIntFromObj(interp, objv[1], &sz) ) return TCL_ERROR;
- if( sz<=0 ){
- sqlite3_mem_methods m;
- memset(&m, 0, sizeof(sqlite3_mem_methods));
- rc = sqlite3_config(SQLITE_CONFIG_MALLOC, &m);
- }else{
- if( sz>sizeof(buf) ){
- sz = sizeof(buf);
- }
- rc = sqlite3_config((int)clientData, buf, sz);
- }
- Tcl_SetResult(interp, (char *)sqlite3TestErrorName(rc), TCL_VOLATILE);
- return TCL_OK;
-}
-
/*
** Usage:
**
if( Tcl_GetIntFromObj(interp, aArg[0], &nByte) ) return TCL_ERROR;
if( Tcl_GetIntFromObj(interp, aArg[1], &nMinAlloc) ) return TCL_ERROR;
- if( nByte>sizeof(zBuf) ){
- nByte = sizeof(zBuf);
+ if( nByte==0 ){
+ sqlite3_mem_methods m;
+ memset(&m, 0, sizeof(sqlite3_mem_methods));
+ rc = sqlite3_config(SQLITE_CONFIG_MALLOC, &m);
+ }else{
+ if( nByte>sizeof(zBuf) ){
+ nByte = sizeof(zBuf);
+ }
+ rc = sqlite3_config(SQLITE_CONFIG_HEAP, zBuf, nByte, nMinAlloc);
+ if( isMemsys3 && rc==SQLITE_OK ){
+ rc = sqlite3_config(SQLITE_CONFIG_MEMSYS3);
+ }
}
- rc = sqlite3_config(SQLITE_CONFIG_HEAP, zBuf, nByte, nMinAlloc);
Tcl_SetResult(interp, (char *)sqlite3TestErrorName(rc), TCL_VOLATILE);
return TCL_OK;
}
switch( (int)clientData ){
- case SQLITE_CONFIG_MEMSYS3: {
+ case 3: {
#ifdef SQLITE_ENABLE_MEMSYS3
extern void sqlite3Memsys3Dump(const char*);
sqlite3Memsys3Dump(Tcl_GetString(objv[1]));
break;
#endif
}
- case SQLITE_CONFIG_MEMSYS5: {
+ case 5: {
#ifdef SQLITE_ENABLE_MEMSYS5
extern void sqlite3Memsys5Dump(const char*);
sqlite3Memsys5Dump(Tcl_GetString(objv[1]));
{ "sqlite3_config_pagecache", test_config_pagecache ,0. },
{ "sqlite3_status", test_status ,0. },
{ "install_malloc_faultsim", test_install_malloc_faultsim ,0. },
- { "sqlite3_config_memsys3", test_config_memsys3, SQLITE_CONFIG_MEMSYS3 },
- { "sqlite3_config_memsys5", test_config_memsys3, SQLITE_CONFIG_MEMSYS5 },
- { "sqlite3_config_heap", test_config_heap, 0 },
- { "sqlite3_dump_memsys3", test_dump_memsys3 , SQLITE_CONFIG_MEMSYS3 },
- { "sqlite3_dump_memsys5", test_dump_memsys3 , SQLITE_CONFIG_MEMSYS5 }
+ { "sqlite3_config_heap", test_config_heap ,0 },
+ { "sqlite3_dump_memsys3", test_dump_memsys3 ,3 },
+ { "sqlite3_dump_memsys5", test_dump_memsys3 ,5 }
};
int i;
for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
#
#***********************************************************************
#
-# $Id: permutations.test,v 1.8 2008/06/27 13:27:04 danielk1977 Exp $
+# $Id: permutations.test,v 1.9 2008/06/27 14:05:25 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
catch {db close}
sqlite3_reset_auto_extension
sqlite3_shutdown
- sqlite3_config_memsys3 1000000
+ sqlite3_config_heap -memsys3 1000000 0
install_malloc_faultsim 1
sqlite3_initialize
autoinstall_test_functions
catch {db close}
sqlite3_reset_auto_extension
sqlite3_shutdown
- sqlite3_config_memsys3 0
+ sqlite3_config_heap 0 0
install_malloc_faultsim 1
sqlite3_initialize
}
catch {db close}
sqlite3_reset_auto_extension
sqlite3_shutdown
- sqlite3_config_memsys5 0
+ sqlite3_config_heap 0 0
install_malloc_faultsim 1
sqlite3_initialize
}
catch {db close}
sqlite3_reset_auto_extension
sqlite3_shutdown
- sqlite3_config_memsys5 0
+ sqlite3_config_heap 0 0
install_malloc_faultsim 1
sqlite3_initialize
}