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

Do not retry on a failed realloc() unless SQLITE_ENABLE_MEMORY_MANAGEMENT

is available, meaning that the retry has some possibility of success.

FossilOrigin-Name: e9a8f910b5e2b84dd77364783f0610bca970cc88aa037c88636c72145b99f411
This commit is contained in:
drh
2020-05-08 10:44:23 +00:00
parent 2d3ed22a3f
commit acc175215a
3 changed files with 10 additions and 8 deletions

View File

@@ -482,10 +482,12 @@ void *sqlite3Realloc(void *pOld, u64 nBytes){
sqlite3MallocAlarm(nDiff);
}
pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
if( pNew==0 && mem0.alarmThreshold>0 ){
sqlite3MallocAlarm((int)nBytes);
pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
}
#endif
if( pNew ){
nNew = sqlite3MallocSize(pNew);
sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nNew-nOld);