aboutsummaryrefslogtreecommitdiff
path: root/src/malloc.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-07-26 18:43:40 +0000
committerdrh <drh@noemail.net>2010-07-26 18:43:40 +0000
commiteafc43b1569260e5ee1d0268cae7fa8ec619d7b8 (patch)
tree22c5baa7268f28dce01831872592a9dd26642fcc /src/malloc.c
parentd2de9f4e6802d0f3c847a6f1dd5aa49a0eef70fb (diff)
downloadsqlite-eafc43b1569260e5ee1d0268cae7fa8ec619d7b8.tar.gz
sqlite-eafc43b1569260e5ee1d0268cae7fa8ec619d7b8.zip
Add the SQLITE_STATUS_MALLOC_COUNT option for sqlite3_status().
FossilOrigin-Name: 8f8e442b3af553753e25c304efa289b626e3a227
Diffstat (limited to 'src/malloc.c')
-rw-r--r--src/malloc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/malloc.c b/src/malloc.c
index 6c107f9aa..42229005c 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -251,6 +251,7 @@ static int mallocWithAlarm(int n, void **pp){
if( p ){
nFull = sqlite3MallocSize(p);
sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nFull);
+ sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, 1);
}
*pp = p;
return nFull;
@@ -446,6 +447,7 @@ void sqlite3_free(void *p){
if( sqlite3GlobalConfig.bMemstat ){
sqlite3_mutex_enter(mem0.mutex);
sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -sqlite3MallocSize(p));
+ sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, -1);
sqlite3GlobalConfig.m.xFree(p);
sqlite3_mutex_leave(mem0.mutex);
}else{