1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Remove the rarely-used scratch memory allocator. This makes the code smaller,

faster, and easier to maintain.  In place of the scratch allocator, add the
SQLITE_CONFIG_SMALL_MALLOC configuration option that provides a hint to SQLite
that large memory allocations should be avoided.

FossilOrigin-Name: 54b000246cfb5c7b8adb61a17357ef5a49adddde9e48e8937834d5ba0beb8a6b
This commit is contained in:
drh
2017-08-28 15:51:35 +00:00
parent b3c4523c58
commit b2a0f75c06
19 changed files with 71 additions and 517 deletions

View File

@@ -436,14 +436,8 @@ int sqlite3_config(int op, ...){
sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
break;
}
case SQLITE_CONFIG_SCRATCH: {
/* EVIDENCE-OF: R-08404-60887 There are three arguments to
** SQLITE_CONFIG_SCRATCH: A pointer an 8-byte aligned memory buffer from
** which the scratch allocations will be drawn, the size of each scratch
** allocation (sz), and the maximum number of scratch allocations (N). */
sqlite3GlobalConfig.pScratch = va_arg(ap, void*);
sqlite3GlobalConfig.szScratch = va_arg(ap, int);
sqlite3GlobalConfig.nScratch = va_arg(ap, int);
case SQLITE_CONFIG_SMALL_MALLOC: {
sqlite3GlobalConfig.bSmallMalloc = va_arg(ap, int);
break;
}
case SQLITE_CONFIG_PAGECACHE: {
@@ -3802,22 +3796,6 @@ int sqlite3_test_control(int op, ...){
}
#endif
/* sqlite3_test_control(SQLITE_TESTCTRL_SCRATCHMALLOC, sz, &pNew, pFree);
**
** Pass pFree into sqlite3ScratchFree().
** If sz>0 then allocate a scratch buffer into pNew.
*/
case SQLITE_TESTCTRL_SCRATCHMALLOC: {
void *pFree, **ppNew;
int sz;
sz = va_arg(ap, int);
ppNew = va_arg(ap, void**);
pFree = va_arg(ap, void*);
if( sz ) *ppNew = sqlite3ScratchMalloc(sz);
sqlite3ScratchFree(pFree);
break;
}
/* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
**
** If parameter onoff is non-zero, configure the wrappers so that all