1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Refactor names. Use "small" instead of "mini" to describe the smaller

of the two lookaside memory allocation sizes.

FossilOrigin-Name: 88d244983854cdc1a369c5df09ae00f1098784db768ba4e17b963d187dcb1009
This commit is contained in:
drh
2019-12-31 15:12:34 +00:00
parent 5f6a2ed7f2
commit cf014f6cbd
7 changed files with 76 additions and 76 deletions

View File

@@ -1,5 +1,5 @@
C Merge\srecent\senhancements\sfrom\strunk. C Refactor\snames.\s\sUse\s"small"\sinstead\sof\s"mini"\sto\sdescribe\sthe\ssmaller\nof\sthe\stwo\slookaside\smemory\sallocation\ssizes.
D 2019-12-31T14:49:10.816 D 2019-12-31T15:12:34.090
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -484,7 +484,7 @@ F src/expr.c 8d4b6ac02f69e60b185cba0e38a76ba3f6f2122ee767e7de0f933fddec423e4a
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 92a248ec0fa4ed8ab60c98d9b188ce173aaf218f32e7737ba77deb2a684f9847 F src/fkey.c 92a248ec0fa4ed8ab60c98d9b188ce173aaf218f32e7737ba77deb2a684f9847
F src/func.c ed33e38cd642058182a31a3f518f2e34f4bbe53aa483335705c153c4d3e50b12 F src/func.c ed33e38cd642058182a31a3f518f2e34f4bbe53aa483335705c153c4d3e50b12
F src/global.c 76da82a621fed40105172969f1a4af93bdab107fa07426f532502c498cf81eb8 F src/global.c 89e36838a355f99cf86b118c3d4078fc3fc95cc9f992cbd70b422da8bfdf1789
F src/hash.c 8d7dda241d0ebdafb6ffdeda3149a412d7df75102cecfc1021c98d6219823b19 F src/hash.c 8d7dda241d0ebdafb6ffdeda3149a412d7df75102cecfc1021c98d6219823b19
F src/hash.h 9d56a9079d523b648774c1784b74b89bd93fac7b365210157482e4319a468f38 F src/hash.h 9d56a9079d523b648774c1784b74b89bd93fac7b365210157482e4319a468f38
F src/hwtime.h cb1d7e3e1ed94b7aa6fde95ae2c2daccc3df826be26fc9ed7fd90d1750ae6144 F src/hwtime.h cb1d7e3e1ed94b7aa6fde95ae2c2daccc3df826be26fc9ed7fd90d1750ae6144
@@ -492,8 +492,8 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c e43c6475b302d094ffa01d76b784c719001c9cf24c0b5af96b78e5b25dc54b83 F src/insert.c e43c6475b302d094ffa01d76b784c719001c9cf24c0b5af96b78e5b25dc54b83
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c d74f5e7bd51f3c9d283442473eb65aef359664efd6513591c03f01881c4ae2da F src/loadext.c d74f5e7bd51f3c9d283442473eb65aef359664efd6513591c03f01881c4ae2da
F src/main.c 34d73303ac76015d3c8961f16d49ab44a56cbc998f178b27ca07847db4cf9273 F src/main.c e9e8da06e089933c3151951be34ac7212212dd8d1551f1d84a2f4416e7af56e0
F src/malloc.c d74d986f91ebd6a4a9b2995467f4c13a1fdb57ac87df5bb0a7fa3afe1db72d1d F src/malloc.c eaa4dc9602ce28b077f7de2eb275db2be270c5cc56d7fec5466301bd9b80e2f5
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3
@@ -533,9 +533,9 @@ F src/shell.c.in 4a3a9e1c11847b1904f2b01d087af1c052f660902755abab457cab1756817de
F src/sqlite.h.in 51f69c62ba3e980aca1e39badcaf9ad13f008774fe1bb8e7f57e3e456c656670 F src/sqlite.h.in 51f69c62ba3e980aca1e39badcaf9ad13f008774fe1bb8e7f57e3e456c656670
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 72af51aa4e912e14cd495fb6e7fac65f0940db80ed950d90911aff292cc47ce2 F src/sqlite3ext.h 72af51aa4e912e14cd495fb6e7fac65f0940db80ed950d90911aff292cc47ce2
F src/sqliteInt.h b5784a17e5ad158a759b2ed0a0d2ded1e1c3e9cf4cf51e4da21783790b9d0567 F src/sqliteInt.h edc69ef8684086e8c195f969e47173ad960a0eb3f6298222b635e2ad3e0c1f98
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
F src/status.c baf38f521ac079be616dab1ff13f60c6ce0703c7f0429a65238c695197a56935 F src/status.c 9ff2210207c6c3b4d9631a8241a7d45ab1b26a0e9c84cb07a9b5ce2de9a3b278
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34 F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
F src/tclsqlite.c 8cd2600e8de23dff6cdf84d39f46ca57139b061b28f6f80b166bace17d52ab1c F src/tclsqlite.c 8cd2600e8de23dff6cdf84d39f46ca57139b061b28f6f80b166bace17d52ab1c
F src/test1.c c654981c1d86ebc90dd23fcc0969e6c85e28112f0acc2e2224a97a2a33e7c42f F src/test1.c c654981c1d86ebc90dd23fcc0969e6c85e28112f0acc2e2224a97a2a33e7c42f
@@ -1853,7 +1853,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 47b71a84d1262c4bf6ad4f4a91820fd63593f08ae9efa144199d44972225e073 1dc83c5d54ca2890112e735e336c209adb8d067d2f647e9f8ae5d58f84a52461 P 39d55579376906f212271ce9b2d367e3ad029fb173f22c7253312b467970208a
R 8dbc460e590e85bbe19d4191ea7ea91a R c6267a3dfb8286b9a7bf015a7e8fc93b
U drh U drh
Z ac3eece56ae65a72ceccf8b58e31752f Z 457f22be9b5a945c48c466bed56b269c

View File

@@ -1 +1 @@
39d55579376906f212271ce9b2d367e3ad029fb173f22c7253312b467970208a 88d244983854cdc1a369c5df09ae00f1098784db768ba4e17b963d187dcb1009

View File

@@ -191,13 +191,13 @@ const unsigned char sqlite3CtypeMap[256] = {
** or at run-time for an individual database connection using ** or at run-time for an individual database connection using
** sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE); ** sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE);
** **
** With the mini-lookaside enhancement, must less lookaside is required. ** With the two-size-lookaside enhancement, less lookaside is required.
** The default configuration of 1200,40 actually proves 30 1200-byte slots ** The default configuration of 1200,40 actually provides 30 1200-byte slots
** and 93 128-byte slots, which is more lookaside slots that are available ** and 93 128-byte slots, which is more lookaside than is available
** using the older 1200,100 configuration without mini-lookaside. ** using the older 1200,100 configuration without two-size-lookaside.
*/ */
#ifndef SQLITE_DEFAULT_LOOKASIDE #ifndef SQLITE_DEFAULT_LOOKASIDE
# ifdef SQLITE_OMIT_MINI_LOOKASIDE # ifdef SQLITE_OMIT_TWOSIZE_LOOKASIDE
# define SQLITE_DEFAULT_LOOKASIDE 1200,100 /* 120KB of memory */ # define SQLITE_DEFAULT_LOOKASIDE 1200,100 /* 120KB of memory */
# else # else
# define SQLITE_DEFAULT_LOOKASIDE 1200,40 /* 48KB of memory */ # define SQLITE_DEFAULT_LOOKASIDE 1200,40 /* 48KB of memory */

View File

@@ -685,7 +685,7 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
void *pStart; void *pStart;
sqlite3_int64 szAlloc = sz*(sqlite3_int64)cnt; sqlite3_int64 szAlloc = sz*(sqlite3_int64)cnt;
int nBig; /* Number of full-size slots */ int nBig; /* Number of full-size slots */
int nSm; /* Number smaller mini-slots */ int nSm; /* Number smaller LOOKASIDE_SMALL-byte slots */
if( sqlite3LookasideUsed(db,0)>0 ){ if( sqlite3LookasideUsed(db,0)>0 ){
return SQLITE_BUSY; return SQLITE_BUSY;
@@ -714,15 +714,15 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
}else{ }else{
pStart = pBuf; pStart = pBuf;
} }
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
if( sz>=MINI_SZ*3 ){ if( sz>=LOOKASIDE_SMALL*3 ){
nBig = szAlloc/(3*MINI_SZ+sz); nBig = szAlloc/(3*LOOKASIDE_SMALL+sz);
nSm = (szAlloc - sz*nBig)/MINI_SZ; nSm = (szAlloc - sz*nBig)/LOOKASIDE_SMALL;
}else if( sz>=MINI_SZ*2 ){ }else if( sz>=LOOKASIDE_SMALL*2 ){
nBig = szAlloc/(MINI_SZ+sz); nBig = szAlloc/(LOOKASIDE_SMALL+sz);
nSm = (szAlloc - sz*nBig)/MINI_SZ; nSm = (szAlloc - sz*nBig)/LOOKASIDE_SMALL;
}else }else
#endif /* SQLITE_OMIT_MINI_LOOKASIDE */ #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
if( sz>0 ){ if( sz>0 ){
nBig = szAlloc/sz; nBig = szAlloc/sz;
nSm = 0; nSm = 0;
@@ -744,16 +744,16 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
db->lookaside.pInit = p; db->lookaside.pInit = p;
p = (LookasideSlot*)&((u8*)p)[sz]; p = (LookasideSlot*)&((u8*)p)[sz];
} }
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
db->lookaside.pMiniInit = 0; db->lookaside.pSmallInit = 0;
db->lookaside.pMiniFree = 0; db->lookaside.pSmallFree = 0;
db->lookaside.pMiddle = p; db->lookaside.pMiddle = p;
for(i=0; i<nSm; i++){ for(i=0; i<nSm; i++){
p->pNext = db->lookaside.pMiniInit; p->pNext = db->lookaside.pSmallInit;
db->lookaside.pMiniInit = p; db->lookaside.pSmallInit = p;
p = (LookasideSlot*)&((u8*)p)[MINI_SZ]; p = (LookasideSlot*)&((u8*)p)[LOOKASIDE_SMALL];
} }
#endif /* SQLITE_OMIT_MINI_LOOKASIDE */ #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
assert( ((uptr)p)<=szAlloc + (uptr)pStart ); assert( ((uptr)p)<=szAlloc + (uptr)pStart );
db->lookaside.pEnd = p; db->lookaside.pEnd = p;
db->lookaside.bDisable = 0; db->lookaside.bDisable = 0;
@@ -761,11 +761,11 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
db->lookaside.nSlot = nBig+nSm; db->lookaside.nSlot = nBig+nSm;
}else{ }else{
db->lookaside.pStart = db; db->lookaside.pStart = db;
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
db->lookaside.pMiniInit = 0; db->lookaside.pSmallInit = 0;
db->lookaside.pMiniFree = 0; db->lookaside.pSmallFree = 0;
db->lookaside.pMiddle = db; db->lookaside.pMiddle = db;
#endif /* SQLITE_OMIT_MINI_LOOKASIDE */ #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
db->lookaside.pEnd = db; db->lookaside.pEnd = db;
db->lookaside.bDisable = 1; db->lookaside.bDisable = 1;
db->lookaside.sz = 0; db->lookaside.sz = 0;

View File

@@ -333,8 +333,8 @@ int sqlite3MallocSize(void *p){
return sqlite3GlobalConfig.m.xSize(p); return sqlite3GlobalConfig.m.xSize(p);
} }
static int lookasideMallocSize(sqlite3 *db, void *p){ static int lookasideMallocSize(sqlite3 *db, void *p){
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
return p<db->lookaside.pMiddle ? db->lookaside.szTrue : MINI_SZ; return p<db->lookaside.pMiddle ? db->lookaside.szTrue : LOOKASIDE_SMALL;
#else #else
return db->lookaside.szTrue; return db->lookaside.szTrue;
#endif #endif
@@ -354,10 +354,10 @@ int sqlite3DbMallocSize(sqlite3 *db, void *p){
#endif #endif
if( db ){ if( db ){
if( ((uptr)p)<(uptr)(db->lookaside.pEnd) ){ if( ((uptr)p)<(uptr)(db->lookaside.pEnd) ){
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){ if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){
assert( sqlite3_mutex_held(db->mutex) ); assert( sqlite3_mutex_held(db->mutex) );
return MINI_SZ; return LOOKASIDE_SMALL;
} }
#endif #endif
if( ((uptr)p)>=(uptr)(db->lookaside.pStart) ){ if( ((uptr)p)>=(uptr)(db->lookaside.pStart) ){
@@ -414,17 +414,17 @@ void sqlite3DbFreeNN(sqlite3 *db, void *p){
return; return;
} }
if( ((uptr)p)<(uptr)(db->lookaside.pEnd) ){ if( ((uptr)p)<(uptr)(db->lookaside.pEnd) ){
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){ if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){
LookasideSlot *pBuf = (LookasideSlot*)p; LookasideSlot *pBuf = (LookasideSlot*)p;
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
memset(p, 0xaa, MINI_SZ); /* Trash freed content */ memset(p, 0xaa, LOOKASIDE_SMALL); /* Trash freed content */
#endif #endif
pBuf->pNext = db->lookaside.pMiniFree; pBuf->pNext = db->lookaside.pSmallFree;
db->lookaside.pMiniFree = pBuf; db->lookaside.pSmallFree = pBuf;
return; return;
} }
#endif /* SQLITE_OMIT_MINI_LOOKASIDE */ #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
if( ((uptr)p)>=(uptr)(db->lookaside.pStart) ){ if( ((uptr)p)>=(uptr)(db->lookaside.pStart) ){
LookasideSlot *pBuf = (LookasideSlot*)p; LookasideSlot *pBuf = (LookasideSlot*)p;
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
@@ -597,14 +597,14 @@ void *sqlite3DbMallocRawNN(sqlite3 *db, u64 n){
} }
return dbMallocRawFinish(db, n); return dbMallocRawFinish(db, n);
} }
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
if( n<=MINI_SZ ){ if( n<=LOOKASIDE_SMALL ){
if( (pBuf = db->lookaside.pMiniFree)!=0 ){ if( (pBuf = db->lookaside.pSmallFree)!=0 ){
db->lookaside.pMiniFree = pBuf->pNext; db->lookaside.pSmallFree = pBuf->pNext;
db->lookaside.anStat[0]++; db->lookaside.anStat[0]++;
return (void*)pBuf; return (void*)pBuf;
}else if( (pBuf = db->lookaside.pMiniInit)!=0 ){ }else if( (pBuf = db->lookaside.pSmallInit)!=0 ){
db->lookaside.pMiniInit = pBuf->pNext; db->lookaside.pSmallInit = pBuf->pNext;
db->lookaside.anStat[0]++; db->lookaside.anStat[0]++;
return (void*)pBuf; return (void*)pBuf;
} }
@@ -644,9 +644,9 @@ void *sqlite3DbRealloc(sqlite3 *db, void *p, u64 n){
if( p==0 ) return sqlite3DbMallocRawNN(db, n); if( p==0 ) return sqlite3DbMallocRawNN(db, n);
assert( sqlite3_mutex_held(db->mutex) ); assert( sqlite3_mutex_held(db->mutex) );
if( ((uptr)p)<(uptr)db->lookaside.pEnd ){ if( ((uptr)p)<(uptr)db->lookaside.pEnd ){
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
if( ((uptr)p)>=(uptr)db->lookaside.pMiddle ){ if( ((uptr)p)>=(uptr)db->lookaside.pMiddle ){
if( n<=MINI_SZ ) return p; if( n<=LOOKASIDE_SMALL ) return p;
}else }else
#endif #endif
if( ((uptr)p)>=(uptr)db->lookaside.pStart ){ if( ((uptr)p)>=(uptr)db->lookaside.pStart ){

View File

@@ -1305,17 +1305,17 @@ struct Schema {
** outstanding at any point in the past - by subtracting the number of ** outstanding at any point in the past - by subtracting the number of
** allocations on the pInit list from the total number of allocations. ** allocations on the pInit list from the total number of allocations.
** **
** Enhancement on 2019-12-12: Mini-lookaside ** Enhancement on 2019-12-12: Two-size-lookaside
** The default lookaside configuration is 100 slots of 1200 bytes each. ** The default lookaside configuration is 100 slots of 1200 bytes each.
** The larger slot sizes are important for performance, but they waste ** The larger slot sizes are important for performance, but they waste
** a lot of space, as most lookaside allocations are less than 128 bytes. ** a lot of space, as most lookaside allocations are less than 128 bytes.
** The mini-lookaside enhancement breaks up the lookaside allocation into ** The two-size-lookaside enhancement breaks up the lookaside allocation
** two pools: One of 128-byte slots and the other of the default size ** into two pools: One of 128-byte slots and the other of the default size
** (1200-byte) slots. Allocations are filled from the mini-pool first, ** (1200-byte) slots. Allocations are filled from the small-pool first,
** failing over to the full-size pool if that does not work. Thus more ** failing over to the full-size pool if that does not work. Thus more
** lookaside slots are available while also using less memory. ** lookaside slots are available while also using less memory.
** This enhancement can be omitted by compiling with ** This enhancement can be omitted by compiling with
** SQLITE_OMIT_MINI_LOOKASIDE. ** SQLITE_OMIT_TWOSIZE_LOOKASIDE.
*/ */
struct Lookaside { struct Lookaside {
u32 bDisable; /* Only operate the lookaside when zero */ u32 bDisable; /* Only operate the lookaside when zero */
@@ -1326,12 +1326,12 @@ struct Lookaside {
u32 anStat[3]; /* 0: hits. 1: size misses. 2: full misses */ u32 anStat[3]; /* 0: hits. 1: size misses. 2: full misses */
LookasideSlot *pInit; /* List of buffers not previously used */ LookasideSlot *pInit; /* List of buffers not previously used */
LookasideSlot *pFree; /* List of available buffers */ LookasideSlot *pFree; /* List of available buffers */
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
LookasideSlot *pMiniInit; /* List of mini buffers not prediously used */ LookasideSlot *pSmallInit; /* List of small buffers not prediously used */
LookasideSlot *pMiniFree; /* List of available mini buffers */ LookasideSlot *pSmallFree; /* List of available small buffers */
void *pMiddle; /* First byte past end of full-size buffers and void *pMiddle; /* First byte past end of full-size buffers and
** the first byte of mini-buffers */ ** the first byte of LOOKASIDE_SMALL buffers */
#endif /* SQLITE_OMIT_MINI_LOOKASIDE */ #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
void *pStart; /* First byte of available memory space */ void *pStart; /* First byte of available memory space */
void *pEnd; /* First byte past end of available space */ void *pEnd; /* First byte past end of available space */
}; };
@@ -1343,11 +1343,11 @@ struct LookasideSlot {
#define EnableLookaside db->lookaside.bDisable--;\ #define EnableLookaside db->lookaside.bDisable--;\
db->lookaside.sz=db->lookaside.bDisable?0:db->lookaside.szTrue db->lookaside.sz=db->lookaside.bDisable?0:db->lookaside.szTrue
/* Size of the MINI lookside allocation */ /* Size of the smaller allocations in two-size lookside */
#ifdef SQLITE_OMIT_MINI_LOOKASIDE #ifdef SQLITE_OMIT_TWOSIZE_LOOKASIDE
# define MINI_SZ 0 # define LOOKASIDE_SMALL 0
#else #else
# define MINI_SZ 128 # define LOOKASIDE_SMALL 128
#endif #endif
/* /*

View File

@@ -188,10 +188,10 @@ static u32 countLookasideSlots(LookasideSlot *p){
int sqlite3LookasideUsed(sqlite3 *db, int *pHighwater){ int sqlite3LookasideUsed(sqlite3 *db, int *pHighwater){
u32 nInit = countLookasideSlots(db->lookaside.pInit); u32 nInit = countLookasideSlots(db->lookaside.pInit);
u32 nFree = countLookasideSlots(db->lookaside.pFree); u32 nFree = countLookasideSlots(db->lookaside.pFree);
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
nInit += countLookasideSlots(db->lookaside.pMiniInit); nInit += countLookasideSlots(db->lookaside.pSmallInit);
nFree += countLookasideSlots(db->lookaside.pMiniFree); nFree += countLookasideSlots(db->lookaside.pSmallFree);
#endif /* SQLITE_OMIT_MINI_LOOKASIDE */ #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
if( pHighwater ) *pHighwater = db->lookaside.nSlot - nInit; if( pHighwater ) *pHighwater = db->lookaside.nSlot - nInit;
return db->lookaside.nSlot - (nInit+nFree); return db->lookaside.nSlot - (nInit+nFree);
} }
@@ -224,13 +224,13 @@ int sqlite3_db_status(
db->lookaside.pInit = db->lookaside.pFree; db->lookaside.pInit = db->lookaside.pFree;
db->lookaside.pFree = 0; db->lookaside.pFree = 0;
} }
#ifndef SQLITE_OMIT_MINI_LOOKASIDE #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
p = db->lookaside.pMiniFree; p = db->lookaside.pSmallFree;
if( p ){ if( p ){
while( p->pNext ) p = p->pNext; while( p->pNext ) p = p->pNext;
p->pNext = db->lookaside.pMiniInit; p->pNext = db->lookaside.pSmallInit;
db->lookaside.pMiniInit = db->lookaside.pMiniFree; db->lookaside.pSmallInit = db->lookaside.pSmallFree;
db->lookaside.pMiniFree = 0; db->lookaside.pSmallFree = 0;
} }
#endif #endif
} }