diff options
author | drh <drh@noemail.net> | 2008-07-16 12:25:32 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-07-16 12:25:32 +0000 |
commit | 7830cd41baaa8181f395e5e45e47454706f360a5 (patch) | |
tree | 7ed5ed17149b2a202765844b60def6f435012c97 /src/test_malloc.c | |
parent | 2a6962adfea81a127d4e51f13a8cdad4921fcf6e (diff) | |
download | sqlite-7830cd41baaa8181f395e5e45e47454706f360a5.tar.gz sqlite-7830cd41baaa8181f395e5e45e47454706f360a5.zip |
Activate testing of mem3 and mem5. Fix problems found. Tickets #3223
and #3225. Other test configuration changes. (CVS 5419)
FossilOrigin-Name: a3a7820540f6f2285e6c83cac84383fc7d60d267
Diffstat (limited to 'src/test_malloc.c')
-rw-r--r-- | src/test_malloc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/test_malloc.c b/src/test_malloc.c index b67bcccab..052f198ea 100644 --- a/src/test_malloc.c +++ b/src/test_malloc.c @@ -13,7 +13,7 @@ ** This file contains code used to implement test interfaces to the ** memory allocation subsystem. ** -** $Id: test_malloc.c,v 1.37 2008/07/11 16:15:18 drh Exp $ +** $Id: test_malloc.c,v 1.38 2008/07/16 12:25:32 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -967,7 +967,8 @@ static int test_config_heap( int objc, Tcl_Obj *CONST objv[] ){ - static char zBuf[1048576]; + static char *zBuf; /* Use this memory */ + static int szBuf; /* Bytes allocated for zBuf */ int nByte; /* Size of buffer to pass to sqlite3_config() */ int nMinAlloc; /* Size of minimum allocation */ int rc; /* Return code of sqlite3_config() */ @@ -983,11 +984,13 @@ static int test_config_heap( if( Tcl_GetIntFromObj(interp, aArg[1], &nMinAlloc) ) return TCL_ERROR; if( nByte==0 ){ + free( zBuf ); + zBuf = 0; + szBuf = 0; rc = sqlite3_config(SQLITE_CONFIG_HEAP, (void*)0, 0, 0); }else{ - if( nByte>sizeof(zBuf) ){ - nByte = sizeof(zBuf); - } + zBuf = realloc(zBuf, nByte); + szBuf = nByte; rc = sqlite3_config(SQLITE_CONFIG_HEAP, zBuf, nByte, nMinAlloc); } |