]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix two asserts on the scratch allocator to allow for up to two outstanding
authordrh <drh@noemail.net>
Sat, 26 Jun 2010 20:25:30 +0000 (20:25 +0000)
committerdrh <drh@noemail.net>
Sat, 26 Jun 2010 20:25:30 +0000 (20:25 +0000)
scratch allocations per thread.

FossilOrigin-Name: f149b498b6ada3fc9f71ee104c351554c80c7f8a

manifest
manifest.uuid
src/malloc.c

index de2d532e009c960e98cf4a756cde362c76e44c31..3dd5e0e409889e072e8d6d7a43b20e7bbc51d3cd 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-C Suppress\sa\scouple\suninitialized\svariable\swarnings.
-D 2010-06-26T20:00:54
+C Fix\stwo\sasserts\son\sthe\sscratch\sallocator\sto\sallow\sfor\sup\sto\stwo\soutstanding\nscratch\sallocations\sper\sthread.
+D 2010-06-26T20:25:31
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -139,7 +139,7 @@ F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
 F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
 F src/loadext.c 1c7a61ce1281041f437333f366a96aa0d29bb581
 F src/main.c a667105394a7e7d173727b96affd35f65b28e608
-F src/malloc.c a08f16d134f0bfab6b20c3cd142ebf3e58235a6a
+F src/malloc.c 09c3777bf733a387bec6aa344e455eb4e8ecf47e
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c 89d4ea8d5cdd55635cbaa48ad53132af6294cbb2
 F src/mem2.c 2ee7bdacda8299b5a91cff9f7ee3e46573195c38
@@ -830,14 +830,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 6e469b63fab3cd63b23110aaceccfed0587c6a87
-R f19744d44e83a56d0757a0d7ef8f0ac1
+P 29571e228cc85f7768c3ad57d0c7af96b5a54983
+R 00c2bd7be8afec6a59e72273f1ab30d7
 U drh
-Z 3036ef0769593a4e1a46673060ced0e2
+Z c4f982247ffd1c88f48964d76577348b
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFMJlx4oxKgR168RlERAuBYAJ9WkkjMIgkcn6fHBpcilaFS4a0qrQCfTpQr
-o0q3NRNiRbFh9yLnn60i+gc=
-=97YZ
+iD8DBQFMJmI+oxKgR168RlERAoSpAJ4l+KyJaanezMkkYJxgloKn2XhHHACaA8eh
+0xUkb3C+vMD00reqw7dY0CA=
+=BMJ5
 -----END PGP SIGNATURE-----
index c2697d05762f9ae4334b901ca3f441922d20339f..ff5201f7f6e99945365f39e6c2d64e0a6048b296 100644 (file)
@@ -1 +1 @@
-29571e228cc85f7768c3ad57d0c7af96b5a54983
\ No newline at end of file
+f149b498b6ada3fc9f71ee104c351554c80c7f8a
\ No newline at end of file
index 6d3b3002ebd7e761522acec9b7be8e7a02c8b244..c7f8a191c20e89c442649c9e0b635397d63d0cdf 100644 (file)
@@ -315,11 +315,11 @@ void *sqlite3ScratchMalloc(int n){
   assert( n>0 );
 
 #if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
-  /* Verify that no more than one scratch allocation per thread
+  /* Verify that no more than two scratch allocation per thread
   ** is outstanding at one time.  (This is only checked in the
   ** single-threaded case since checking in the multi-threaded case
   ** would be much more complicated.) */
-  assert( scratchAllocOut==0 );
+  assert( scratchAllocOut<=1 );
 #endif
 
   if( sqlite3GlobalConfig.szScratch<n ){
@@ -364,16 +364,6 @@ scratch_overflow:
 }
 void sqlite3ScratchFree(void *p){
   if( p ){
-
-#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
-    /* Verify that no more than one scratch allocation per thread
-    ** is outstanding at one time.  (This is only checked in the
-    ** single-threaded case since checking in the multi-threaded case
-    ** would be much more complicated.) */
-    assert( scratchAllocOut==1 );
-    scratchAllocOut = 0;
-#endif
-
     if( sqlite3GlobalConfig.pScratch==0
            || p<sqlite3GlobalConfig.pScratch
            || p>=(void*)mem0.aScratchFree ){
@@ -399,6 +389,16 @@ void sqlite3ScratchFree(void *p){
       mem0.aScratchFree[mem0.nScratchFree++] = i;
       sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, -1);
       sqlite3_mutex_leave(mem0.mutex);
+
+#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
+    /* Verify that no more than two scratch allocation per thread
+    ** is outstanding at one time.  (This is only checked in the
+    ** single-threaded case since checking in the multi-threaded case
+    ** would be much more complicated.) */
+    assert( scratchAllocOut>=1 && scratchAllocOut<=2 );
+    scratchAllocOut = 0;
+#endif
+
     }
   }
 }