From: drh Date: Thu, 7 Jan 2016 21:12:40 +0000 (+0000) Subject: Omit performance tracking from the memsys5 memory allocator if neither X-Git-Tag: version-3.11.0~178 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9d6d1b67b4a3c140437f1a48045efab65357958;p=thirdparty%2Fsqlite.git Omit performance tracking from the memsys5 memory allocator if neither SQLITE_DEBUG nor SQLITE_TEST are defined. FossilOrigin-Name: af5c7714e993f060841f1e893f754ddf3870e6d0 --- diff --git a/manifest b/manifest index 1f5fbe7bdd..fbb4b40d59 100644 --- a/manifest +++ b/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 diff --git a/manifest.uuid b/manifest.uuid index d6aa2d2612..9cc6b8eedd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2d96aeba2460779a0a20356739a0ba49144c8a85 \ No newline at end of file +af5c7714e993f060841f1e893f754ddf3870e6d0 \ No newline at end of file diff --git a/src/mem5.c b/src/mem5.c index 49bebca093..7316a630a6 100644 --- a/src/mem5.c +++ b/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; iFullSz0 ); 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