diff options
author | drh <drh@noemail.net> | 2007-10-20 16:11:39 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-10-20 16:11:39 +0000 |
commit | c0ad3e8df68ad6e3210b2ce8188d7dd3e11e11dd (patch) | |
tree | 98fff13c8da978b8f1af5846ad9f96078d0a984a /src | |
parent | a4e5d58f02467225358dcabc10bfdda33f845711 (diff) | |
download | sqlite-c0ad3e8df68ad6e3210b2ce8188d7dd3e11e11dd.tar.gz sqlite-c0ad3e8df68ad6e3210b2ce8188d7dd3e11e11dd.zip |
Bug fix in the realloc algorithm of the static memory allocator. (CVS 4497)
FossilOrigin-Name: 50db16be5025f6d5efc51e3354615059da7e8611
Diffstat (limited to 'src')
-rw-r--r-- | src/mem3.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mem3.c b/src/mem3.c index 52663e574..4b6fcf6c6 100644 --- a/src/mem3.c +++ b/src/mem3.c @@ -20,7 +20,7 @@ ** This version of the memory allocation subsystem is used if ** and only if SQLITE_MEMORY_SIZE is defined. ** -** $Id: mem3.c,v 1.3 2007/10/20 15:41:58 drh Exp $ +** $Id: mem3.c,v 1.4 2007/10/20 16:11:39 drh Exp $ */ /* @@ -274,7 +274,7 @@ static void memsys3OutOfMemory(int nByte){ static int memsys3Size(void *p){ Mem3Block *pBlock = (Mem3Block*)p; assert( pBlock[-1].u.hdr.size<0 ); - return (1-pBlock[-1].u.hdr.size)*8; + return (-1-pBlock[-1].u.hdr.size)*8; } /* @@ -517,11 +517,9 @@ void *sqlite3_realloc(void *pPrior, int nBytes){ } assert( mem.mutex!=0 ); nOld = memsys3Size(pPrior); -#if 0 if( nBytes<=nOld && nBytes>=nOld-128 ){ return pPrior; } -#endif sqlite3_mutex_enter(mem.mutex); p = memsys3Malloc(nBytes); if( p ){ |