diff options
author | dan <dan@noemail.net> | 2010-08-11 06:04:19 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-08-11 06:04:19 +0000 |
commit | 216eaab2822b1ac5a91bd6ebaf985e9d8455f35b (patch) | |
tree | 767e1276efbce92ddf5185719f38d5140aa21275 /src/test_malloc.c | |
parent | 84612fec1c94840c7175a4aa03ffac5505960467 (diff) | |
parent | 7e68423894fae26d25ef4e1d6b8513469020db07 (diff) | |
download | sqlite-216eaab2822b1ac5a91bd6ebaf985e9d8455f35b.tar.gz sqlite-216eaab2822b1ac5a91bd6ebaf985e9d8455f35b.zip |
Merge experimental changes into trunk.
FossilOrigin-Name: aa092ac928dc19bd356d25a1dfd3f432dc145ce6
Diffstat (limited to 'src/test_malloc.c')
-rw-r--r-- | src/test_malloc.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/test_malloc.c b/src/test_malloc.c index 3fa753b7e..08642c9fe 100644 --- a/src/test_malloc.c +++ b/src/test_malloc.c @@ -728,7 +728,10 @@ static int test_memdebug_settitle( return TCL_OK; } -#define MALLOC_LOG_FRAMES 10 +#define MALLOC_LOG_FRAMES 10 +#define MALLOC_LOG_KEYINTS ( \ + 10 * ((sizeof(int)>=sizeof(void*)) ? 1 : sizeof(void*)/sizeof(int)) \ +) static Tcl_HashTable aMallocLog; static int mallocLogEnabled = 0; @@ -745,8 +748,8 @@ static void test_memdebug_callback(int nByte, int nFrame, void **aFrame){ Tcl_HashEntry *pEntry; int isNew; - int aKey[MALLOC_LOG_FRAMES]; - int nKey = sizeof(int)*MALLOC_LOG_FRAMES; + int aKey[MALLOC_LOG_KEYINTS]; + int nKey = sizeof(int)*MALLOC_LOG_KEYINTS; memset(aKey, 0, nKey); if( (sizeof(void*)*nFrame)<nKey ){ @@ -781,7 +784,7 @@ static void test_memdebug_log_clear(void){ Tcl_Free((char *)pLog); } Tcl_DeleteHashTable(&aMallocLog); - Tcl_InitHashTable(&aMallocLog, MALLOC_LOG_FRAMES); + Tcl_InitHashTable(&aMallocLog, MALLOC_LOG_KEYINTS); } static int test_memdebug_log( @@ -804,7 +807,7 @@ static int test_memdebug_log( void (*xBacktrace)(int, int, void **)); sqlite3MemdebugBacktraceCallback(test_memdebug_callback); #endif - Tcl_InitHashTable(&aMallocLog, MALLOC_LOG_FRAMES); + Tcl_InitHashTable(&aMallocLog, MALLOC_LOG_KEYINTS); isInit = 1; } @@ -827,7 +830,7 @@ static int test_memdebug_log( Tcl_HashEntry *pEntry; Tcl_Obj *pRet = Tcl_NewObj(); - assert(sizeof(int)==sizeof(void*)); + assert(sizeof(Tcl_WideInt)>=sizeof(void*)); for( pEntry=Tcl_FirstHashEntry(&aMallocLog, &search); @@ -836,13 +839,13 @@ static int test_memdebug_log( ){ Tcl_Obj *apElem[MALLOC_LOG_FRAMES+2]; MallocLog *pLog = (MallocLog *)Tcl_GetHashValue(pEntry); - int *aKey = (int *)Tcl_GetHashKey(&aMallocLog, pEntry); + Tcl_WideInt *aKey = (Tcl_WideInt *)Tcl_GetHashKey(&aMallocLog, pEntry); int ii; apElem[0] = Tcl_NewIntObj(pLog->nCall); apElem[1] = Tcl_NewIntObj(pLog->nByte); for(ii=0; ii<MALLOC_LOG_FRAMES; ii++){ - apElem[ii+2] = Tcl_NewIntObj(aKey[ii]); + apElem[ii+2] = Tcl_NewWideIntObj(aKey[ii]); } Tcl_ListObjAppendElement(interp, pRet, |