Omit performance tracking from the memsys5 memory allocator if neither
SQLITE_DEBUG nor SQLITE_TEST are defined. FossilOrigin-Name: af5c7714e993f060841f1e893f754ddf3870e6d0
This commit is contained in:
parent
cad2486543
commit
c9d6d1b67b
13
manifest
13
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sto\scause\sBtShared.db\sto\sbe\sset\scorrectly\son\sshared-cache\nconnections\sin\sSQLITE_THREADSAFE=0\sbuilds.\s\sAdded\sassert()s\sto\sverify\nthe\scorrect\ssetting\sof\sBtShared.db.
|
||||
D 2016-01-07T17:19:24.484
|
||||
C Omit\sperformance\stracking\sfrom\sthe\smemsys5\smemory\sallocator\sif\sneither\nSQLITE_DEBUG\snor\sSQLITE_TEST\sare\sdefined.
|
||||
D 2016-01-07T21:12:40.900
|
||||
F Makefile.in 7c8cc4c2f0179efc6fa9492141d1fb65f4807054
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc e45d8b9b56dfa3f2cd860b2c28bd9d304513b042
|
||||
@ -304,7 +304,7 @@ F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b
|
||||
F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3
|
||||
F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a
|
||||
F src/mem5.c 262055c242fa7db59c5f07ad77fdc4e97888c054
|
||||
F src/mem5.c 71f81a11fc5e29a57428761ab38a7bf2ef4ee19d
|
||||
F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85
|
||||
F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495
|
||||
F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c
|
||||
@ -1406,8 +1406,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 828958ff77a5c239d55302f570077835c093e0fa 359277e0e5338f6d7743d58cf99e1c934a8460d5
|
||||
R 6a20a209200c5a1c13b83cee78194e2e
|
||||
T +closed 359277e0e5338f6d7743d58cf99e1c934a8460d5
|
||||
P 2d96aeba2460779a0a20356739a0ba49144c8a85
|
||||
R 0f87ccc97eed432e32f05b109bfdb1a7
|
||||
U drh
|
||||
Z 1846b22def634146b1c38f34bfdda1cc
|
||||
Z 9752f7a1ad4b146c9e3d9fcb5efbd790
|
||||
|
@ -1 +1 @@
|
||||
2d96aeba2460779a0a20356739a0ba49144c8a85
|
||||
af5c7714e993f060841f1e893f754ddf3870e6d0
|
16
src/mem5.c
16
src/mem5.c
@ -102,6 +102,7 @@ static SQLITE_WSD struct Mem5Global {
|
||||
*/
|
||||
sqlite3_mutex *mutex;
|
||||
|
||||
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
||||
/*
|
||||
** Performance statistics
|
||||
*/
|
||||
@ -113,6 +114,7 @@ static SQLITE_WSD struct Mem5Global {
|
||||
u32 maxOut; /* Maximum instantaneous currentOut */
|
||||
u32 maxCount; /* Maximum instantaneous currentCount */
|
||||
u32 maxRequest; /* Largest allocation (exclusive of internal frag) */
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Lists of free blocks. aiFreelist[0] is a list of free blocks of
|
||||
@ -224,14 +226,17 @@ static void *memsys5MallocUnsafe(int nByte){
|
||||
/* nByte must be a positive */
|
||||
assert( nByte>0 );
|
||||
|
||||
/* No more than 1GiB per allocation */
|
||||
if( nByte > 0x40000000 ) return 0;
|
||||
|
||||
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
||||
/* Keep track of the maximum allocation request. Even unfulfilled
|
||||
** requests are counted */
|
||||
if( (u32)nByte>mem5.maxRequest ){
|
||||
/* Abort if the requested allocation size is larger than the largest
|
||||
** power of two that we can represent using 32-bit signed integers. */
|
||||
if( nByte > 0x40000000 ) return 0;
|
||||
mem5.maxRequest = nByte;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Round nByte up to the next valid power of two */
|
||||
for(iFullSz=mem5.szAtom,iLogsize=0; iFullSz<nByte; iFullSz*=2,iLogsize++){}
|
||||
@ -258,6 +263,7 @@ static void *memsys5MallocUnsafe(int nByte){
|
||||
}
|
||||
mem5.aCtrl[i] = iLogsize;
|
||||
|
||||
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
||||
/* Update allocator performance statistics. */
|
||||
mem5.nAlloc++;
|
||||
mem5.totalAlloc += iFullSz;
|
||||
@ -266,6 +272,7 @@ static void *memsys5MallocUnsafe(int nByte){
|
||||
mem5.currentOut += iFullSz;
|
||||
if( mem5.maxCount<mem5.currentCount ) mem5.maxCount = mem5.currentCount;
|
||||
if( mem5.maxOut<mem5.currentOut ) mem5.maxOut = mem5.currentOut;
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
/* Make sure the allocated memory does not assume that it is set to zero
|
||||
@ -300,12 +307,15 @@ static void memsys5FreeUnsafe(void *pOld){
|
||||
|
||||
mem5.aCtrl[iBlock] |= CTRL_FREE;
|
||||
mem5.aCtrl[iBlock+size-1] |= CTRL_FREE;
|
||||
|
||||
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
||||
assert( mem5.currentCount>0 );
|
||||
assert( mem5.currentOut>=(size*mem5.szAtom) );
|
||||
mem5.currentCount--;
|
||||
mem5.currentOut -= size*mem5.szAtom;
|
||||
assert( mem5.currentOut>0 || mem5.currentCount==0 );
|
||||
assert( mem5.currentCount>0 || mem5.currentOut==0 );
|
||||
#endif
|
||||
|
||||
mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;
|
||||
while( ALWAYS(iLogsize<LOGMAX) ){
|
||||
|
Loading…
x
Reference in New Issue
Block a user