diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/malloc.c | 2 | ||||
-rw-r--r-- | src/sqlite.h.in | 1 | ||||
-rw-r--r-- | src/status.c | 4 | ||||
-rw-r--r-- | src/test_malloc.c | 1 |
4 files changed, 6 insertions, 2 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{ diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 89bcf1c40..0c71848d3 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -5204,6 +5204,7 @@ int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); #define SQLITE_STATUS_PARSER_STACK 6 #define SQLITE_STATUS_PAGECACHE_SIZE 7 #define SQLITE_STATUS_SCRATCH_SIZE 8 +#define SQLITE_STATUS_MALLOC_COUNT 9 /* ** CAPI3REF: Database Connection Status diff --git a/src/status.c b/src/status.c index da908bbdc..6f141666e 100644 --- a/src/status.c +++ b/src/status.c @@ -21,8 +21,8 @@ */ typedef struct sqlite3StatType sqlite3StatType; static SQLITE_WSD struct sqlite3StatType { - int nowValue[9]; /* Current value */ - int mxValue[9]; /* Maximum value */ + int nowValue[10]; /* Current value */ + int mxValue[10]; /* Maximum value */ } sqlite3Stat = { {0,}, {0,} }; diff --git a/src/test_malloc.c b/src/test_malloc.c index e32b78e20..3fa753b7e 100644 --- a/src/test_malloc.c +++ b/src/test_malloc.c @@ -1237,6 +1237,7 @@ static int test_status( { "SQLITE_STATUS_SCRATCH_OVERFLOW", SQLITE_STATUS_SCRATCH_OVERFLOW }, { "SQLITE_STATUS_SCRATCH_SIZE", SQLITE_STATUS_SCRATCH_SIZE }, { "SQLITE_STATUS_PARSER_STACK", SQLITE_STATUS_PARSER_STACK }, + { "SQLITE_STATUS_MALLOC_COUNT", SQLITE_STATUS_MALLOC_COUNT }, }; Tcl_Obj *pResult; if( objc!=3 ){ |