From: drh Date: Tue, 1 Sep 2015 19:51:37 +0000 (+0000) Subject: Reduce the number of calls to sqlite3BeginBenignMalloc(). X-Git-Tag: version-3.9.0~171 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c0c43191a8c26da304707f8a35676dcba9bf86b;p=thirdparty%2Fsqlite.git Reduce the number of calls to sqlite3BeginBenignMalloc(). FossilOrigin-Name: 0bee6583665782fac5d9e82bdf19b6f07e7bd03f --- diff --git a/manifest b/manifest index cb2ed48858..76d7c2d688 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\sjson_extract()\sfunction\sso\sthat\sif\sgiven\smultiple\sPATH\sarguments\nit\swill\sreturn\sa\sJSON\sarray\swith\sall\sof\sthe\sanswers.\s\sAlso\supdate\scomments\nwithin\sthe\sjson1\sextension\sto\sreflect\sstricter\sinterpretation\sof\sJSON\sand\sPATH\narguments. -D 2015-08-29T19:41:45.279 +C Reduce\sthe\snumber\sof\scalls\sto\ssqlite3BeginBenignMalloc(). +D 2015-09-01T19:51:37.710 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in f85066ce844a28b671aaeeff320921cd0ce36239 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -329,7 +329,7 @@ F src/pager.h 6d435f563b3f7fcae4b84433b76a6ac2730036e2 F src/parse.y f599aa5e871a493330d567ced93de696f61f48f7 F src/pcache.c cde06aa50962595e412d497e22fd2e07878ba1f0 F src/pcache.h 9968603796240cdf83da7e7bef76edf90619cea9 -F src/pcache1.c a3fe31b17e841ec70beee72a2c960e9c787a8857 +F src/pcache1.c b31af9dbc83b9c68e87d681b8453a9605f28e734 F src/pragma.c a239d2c8c6d87d589927547f234b0f6259c69f62 F src/pragma.h 631a91c8b0e6ca8f051a1d8a4a0da4150e04620a F src/prepare.c 82e5db1013846a819f198336fed72c44c974e7b1 @@ -1380,7 +1380,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2e8e239cec5a12ac81cf62c0fbe94fb5713c31b1 -R e2bf483acb1667e13821f8d776f13acb +P 1da60c3dda4254620052a83c853c2d2b6dd5009f +R a8dadc2be409ee0f9230c079f3e60bef U drh -Z ec66207700973851a4a5019af1bd75d1 +Z e7045dcb0c08a97552c700c3dabf771a diff --git a/manifest.uuid b/manifest.uuid index 17d2b0dd8c..9968e7640c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1da60c3dda4254620052a83c853c2d2b6dd5009f \ No newline at end of file +0bee6583665782fac5d9e82bdf19b6f07e7bd03f \ No newline at end of file diff --git a/src/pcache1.c b/src/pcache1.c index bb01d66c4f..18df8c87d3 100644 --- a/src/pcache1.c +++ b/src/pcache1.c @@ -392,7 +392,7 @@ static int pcache1MemSize(void *p){ /* ** Allocate a new page object initially associated with cache pCache. */ -static PgHdr1 *pcache1AllocPage(PCache1 *pCache){ +static PgHdr1 *pcache1AllocPage(PCache1 *pCache, int benignMalloc){ PgHdr1 *p = 0; void *pPg; @@ -410,6 +410,7 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache){ assert( pCache->pGroup==&pcache1.grp ); pcache1LeaveMutex(pCache->pGroup); #endif + if( benignMalloc ) sqlite3BeginBenignMalloc(); #ifdef SQLITE_PCACHE_SEPARATE_HEADER pPg = pcache1Alloc(pCache->szPage); p = sqlite3Malloc(sizeof(PgHdr1) + pCache->szExtra); @@ -422,6 +423,7 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache){ pPg = pcache1Alloc(pCache->szAlloc); p = (PgHdr1 *)&((u8 *)pPg)[pCache->szPage]; #endif + if( benignMalloc ) sqlite3EndBenignMalloc(); #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT pcache1EnterMutex(pCache->pGroup); #endif @@ -867,9 +869,7 @@ static SQLITE_NOINLINE PgHdr1 *pcache1FetchStage2( ** attempt to allocate a new one. */ if( !pPage ){ - if( createFlag==1 ){ sqlite3BeginBenignMalloc(); } - pPage = pcache1AllocPage(pCache); - if( createFlag==1 ){ sqlite3EndBenignMalloc(); } + pPage = pcache1AllocPage(pCache, createFlag==1); } if( pPage ){