diff options
author | dan <dan@noemail.net> | 2010-07-27 18:36:37 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-07-27 18:36:37 +0000 |
commit | eb8def8449b3a668900d017069c6b04b9f9e86c2 (patch) | |
tree | 8c28eb7373da3f1d80e76c6cabfe09d216bd60c5 /src | |
parent | 6e09d69c92ca81c7a8ffda7a26bf74e807ad3371 (diff) | |
parent | d7ceb372aa9afa37012d15eeb0290ec5c1a1261c (diff) | |
download | sqlite-eb8def8449b3a668900d017069c6b04b9f9e86c2.tar.gz sqlite-eb8def8449b3a668900d017069c6b04b9f9e86c2.zip |
Merge trunk changes into experimental branch.
FossilOrigin-Name: 621824092d443425c420ba9010bbe1202fe99ea2
Diffstat (limited to 'src')
-rw-r--r-- | src/malloc.c | 3 | ||||
-rw-r--r-- | src/sqlite.h.in | 1 | ||||
-rw-r--r-- | src/status.c | 8 | ||||
-rw-r--r-- | src/test_malloc.c | 1 |
4 files changed, 9 insertions, 4 deletions
diff --git a/src/malloc.c b/src/malloc.c index 6c107f9aa..b36b44f7f 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; @@ -375,6 +376,7 @@ void sqlite3ScratchFree(void *p){ sqlite3_mutex_enter(mem0.mutex); sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, -iSize); sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -iSize); + sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, -1); sqlite3GlobalConfig.m.xFree(p); sqlite3_mutex_leave(mem0.mutex); }else{ @@ -446,6 +448,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 ca0ea5dd4..eab2b3a84 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -5205,6 +5205,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..7f05f1c68 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,} }; @@ -150,8 +150,8 @@ int sqlite3_db_status( db->pnBytesFreed = &nByte; for(i=0; i<db->nDb; i++){ Schema *pSchema = db->aDb[i].pSchema; - if( pSchema ){ - HashElem *p; + if( ALWAYS(pSchema!=0) ){ + HashElem *p; nByte += sqlite3GlobalConfig.m.xRoundup(sizeof(HashElem)) * ( pSchema->tblHash.count 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 ){ |