aboutsummaryrefslogtreecommitdiff
path: root/src/malloc.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2011-05-05 17:00:51 +0000
committerdrh <drh@noemail.net>2011-05-05 17:00:51 +0000
commit2e5a422eee1c2c9d1e87de910c2b165952bfdffa (patch)
treefda7ebc55e58bb8a0800097edf4cff607708c960 /src/malloc.c
parentef45bb75b305bcd231c069c84a9761660e7243b8 (diff)
downloadsqlite-2e5a422eee1c2c9d1e87de910c2b165952bfdffa.tar.gz
sqlite-2e5a422eee1c2c9d1e87de910c2b165952bfdffa.zip
Fix a bug in memory usage tracking that was introduced by
check-in [4e33a0eaf83922]. FossilOrigin-Name: 8ba456ae0b3d0c0b6f72f98bd0bc28f72dfa4ff5
Diffstat (limited to 'src/malloc.c')
-rw-r--r--src/malloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/malloc.c b/src/malloc.c
index 3585f1245..3e38d1df9 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -533,7 +533,7 @@ void *sqlite3Realloc(void *pOld, int nBytes){
nDiff = nNew - nOld;
if( sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED) >=
mem0.alarmThreshold-nDiff ){
- sqlite3MallocAlarm(nNew-nOld);
+ sqlite3MallocAlarm(nDiff);
}
assert( sqlite3MemdebugHasType(pOld, MEMTYPE_HEAP) );
assert( sqlite3MemdebugNoType(pOld, ~MEMTYPE_HEAP) );
@@ -544,7 +544,7 @@ void *sqlite3Realloc(void *pOld, int nBytes){
}
if( pNew ){
nNew = sqlite3MallocSize(pNew);
- sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nDiff);
+ sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nNew-nOld);
}
sqlite3_mutex_leave(mem0.mutex);
}else{