]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
If MEM_STATUS is disabled, avoid holding the STATIC_MEM mutex when calling the user...
authordan <dan@noemail.net>
Thu, 2 Sep 2010 10:08:41 +0000 (10:08 +0000)
committerdan <dan@noemail.net>
Thu, 2 Sep 2010 10:08:41 +0000 (10:08 +0000)
FossilOrigin-Name: 4f20f8ba73691c8a1dc33d2fcd1e793dd08f00a8

manifest
manifest.uuid
src/malloc.c
test/permutations.test

index 65f34a88c7608bca08c3d9f5d6eab981ab3edc86..7b5be56b2c571dbde1f5edc21da75eef7bec1242 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sfew\stypos.\s\sUpdate\sevidence\smarks.
-D 2010-09-02T04:30:19
+C If\sMEM_STATUS\sis\sdisabled,\savoid\sholding\sthe\sSTATIC_MEM\smutex\swhen\scalling\sthe\suser-defined\sxMalloc\smethod.\sHolding\sthe\smutex\scauses\sproblems\sfor\smemsys3\sand\smemsys5.
+D 2010-09-02T10:08:41
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -139,7 +139,7 @@ F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
 F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
 F src/loadext.c 6d422ea91cf3d2d00408c5a8f2391cd458da85f8
 F src/main.c b92c6c9a302999975897730b2808708fbf531a56
-F src/malloc.c d9fcf07f366a29d45d4c3157323074578912b83c
+F src/malloc.c 8b67cb6ba7853ad166fd6909ca5f702bf063c053
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c 00bd8265c81abb665c48fea1e0c234eb3b922206
 F src/mem2.c e307323e86b5da1853d7111b68fd6b84ad6f09cf
@@ -555,7 +555,7 @@ F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806
 F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb
 F test/pcache.test 4118a183908ecaed343a06fcef3ba82e87e0129d
 F test/pcache2.test 0d85f2ab6963aee28c671d4c71bec038c00a1d16
-F test/permutations.test fff338765bb6d9235d385ead4e6d5c9433b6ba05
+F test/permutations.test 9c73c6524ad0603b9f6ab3d49c77ac5a94919732
 F test/pragma.test ed78d200f65c6998df51196cb8c39d5300570f24
 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
 F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea
@@ -853,7 +853,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 47064453c396d5204a851b8ec08d665e2b12228a
-R 5316ca78a31d0600ba648eb3697b1628
-U shaneh
-Z fd2dbfe354669eca2760f91876afbc58
+P c90a68b77e03bb351a7781f1b9dea38f5f571dcf
+R 8ea9ea167aeaca9c298d5f0ede771876
+U dan
+Z d79bb8b6ec3d7a429b2e5218ed3eb161
index 8ba87aac17bf3806654989b05e51ef6d54908a39..ae3d569c91d526fc1d8f11c1a552e5a8d1e48f43 100644 (file)
@@ -1 +1 @@
-c90a68b77e03bb351a7781f1b9dea38f5f571dcf
\ No newline at end of file
+4f20f8ba73691c8a1dc33d2fcd1e793dd08f00a8
\ No newline at end of file
index ac1910389b1d1ff35dd0d543468a210dc27733d5..f6f75565f3be6c964337208c833c24482f3efe16 100644 (file)
@@ -352,17 +352,21 @@ void *sqlite3ScratchMalloc(int n){
     mem0.nScratchFree--;
     sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, 1);
     sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
+    sqlite3_mutex_leave(mem0.mutex);
   }else{
     if( sqlite3GlobalConfig.bMemstat ){
       sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
       n = mallocWithAlarm(n, &p);
       if( p ) sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, n);
+      sqlite3_mutex_leave(mem0.mutex);
     }else{
+      sqlite3_mutex_leave(mem0.mutex);
       p = sqlite3GlobalConfig.m.xMalloc(n);
     }
     sqlite3MemdebugSetType(p, MEMTYPE_SCRATCH);
   }
-  sqlite3_mutex_leave(mem0.mutex);
+  assert( !sqlite3_mutex_held(mem0.mutex) );
+
 
 #if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
   /* Verify that no more than two scratch allocations per thread
index 2c3d0f37375c6ae36047cb73f1d08efb262b4fc5..06f629468f081ba7b94ffc29ee45067e5b180d15 100644 (file)
@@ -587,6 +587,7 @@ ifcapable mem5 {
   } -initialize {
     catch {db close}
     sqlite3_shutdown
+    sqlite3_config_memstatus 0
     sqlite3_config_heap 40000000 16
     sqlite3_config_lookaside 0 0
     install_malloc_faultsim 1