Improve the comments associated with SQLITE_TEST_REALLOC_STRESS and add

an extra assert() to prove an assumption.

FossilOrigin-Name: 35c454616321d480ecbc4efdf6869bbcdf0d3aa2
This commit is contained in:
drh
2014-08-12 14:29:20 +00:00
parent d79d27aeda
commit 81e069eee5
3 changed files with 18 additions and 13 deletions
+7 -7
View File
@@ -1,5 +1,5 @@
C Run\sa\stest\swith\sTEST_REALLOC_STRESS\sand\sOMIT_LOOKASIDE\sdefined\sas\spart\sof\sreleasetest.tcl\son\sLinux/x86-64.
D 2014-08-12T14:06:13.039
C Improve\sthe\scomments\sassociated\swith\sSQLITE_TEST_REALLOC_STRESS\sand\sadd\nan\sextra\sassert()\sto\sprove\san\sassumption.
D 2014-08-12T14:29:20.012
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -287,7 +287,7 @@ F src/vdbe.c cd8d7e3ecd3e0e0684f6bf48469966335c666883
F src/vdbe.h c63fad052c9e7388d551e556e119c0bcf6bebdf8
F src/vdbeInt.h f5513f2b5ac1e2c5128996c7ea23add256a301df
F src/vdbeapi.c 24e40422382beb774daab11fe9fe9d37e8a04949
F src/vdbeaux.c d83ca171e5df5fdea95e61b6e935d78c02b9d982
F src/vdbeaux.c 25d62ef82cf1be2a1255eacac636fa0d943d8b3d
F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac
F src/vdbemem.c d90a1e8acf8b63dc9d14cbbea12bfec6cec31394
F src/vdbesort.c f7f5563bf7d4695ca8f3203f3bf9de96d04ed0b3
@@ -1186,7 +1186,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 4c291827224b84487a38e7ccba2edabc0f15b5ba
R 1284079e980f8822b336e39d17ba6126
U dan
Z b89cd6a3a53bd57f0d4f91bd2d9a8d6b
P a1baf3a7b177728cdfcd6d9345a0d6bf0a8887c0
R f180a595651acb4f056167092db3a8a0
U drh
Z 0f6249f5f46f843c4c724ed2717337d8
+1 -1
View File
@@ -1 +1 @@
a1baf3a7b177728cdfcd6d9345a0d6bf0a8887c0
35c454616321d480ecbc4efdf6869bbcdf0d3aa2
+10 -5
View File
@@ -85,7 +85,8 @@ void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
/*
** Resize the Vdbe.aOp array so that it is at least nOp elements larger
** its current size. nOp is guaranteed to be less than or equal to 1024.
** than its current size. nOp is guaranteed to be less than or equal
** to 1024/sizeof(Op).
**
** If an out-of-memory error occurs while resizing the array, return
** SQLITE_NOMEM. In this case Vdbe.aOp and Parse.nOpAlloc remain
@@ -96,10 +97,13 @@ static int growOpArray(Vdbe *v, int nOp){
VdbeOp *pNew;
Parse *p = v->pParse;
/* If SQLITE_TEST_REALLOC_STRESS is defined and the current op array is
** less than 512 entries in size, grow the op array by the minimum amount
** required. Otherwise, allocate either double the current size of the
** array or 1KB of space, whichever is smaller. */
/* The SQLITE_TEST_REALLOC_STRESS compile-time option is designed to force
** more frequent reallocs and hence provide more opportunities for
** simulated OOM faults. SQLITE_TEST_REALLOC_STRESS is generally used
** during testing only. With SQLITE_TEST_REALLOC_STRESS grow the op array
** by the minimum* amount required until the size reaches 512. Normal
** operation (without SQLITE_TEST_REALLOC_STRESS) is to double the current
** size of the op array or add 1KB of space, whichever is smaller. */
#ifdef SQLITE_TEST_REALLOC_STRESS
int nNew = (p->nOpAlloc>=512 ? p->nOpAlloc*2 : p->nOpAlloc+nOp);
#else
@@ -107,6 +111,7 @@ static int growOpArray(Vdbe *v, int nOp){
UNUSED_PARAMETER(nOp);
#endif
assert( nOp<=(1024/sizeof(Op)) );
assert( nNew>=(p->nOpAlloc+nOp) );
pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op));
if( pNew ){