From: drh Date: Tue, 9 Jun 2009 19:53:58 +0000 (+0000) Subject: Remove the actual checks that verify that memory pools (such as set up X-Git-Tag: version-3.6.15~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6860da015f0fd7e62fc7ace150fa8db61f58eba8;p=thirdparty%2Fsqlite.git Remove the actual checks that verify that memory pools (such as set up using SQLITE_CONFIG_HEAP) are 8-byte aligned. But document that 8-byte alignment is required. (CVS 6742) FossilOrigin-Name: e9b55ccc8b6d4f21c9c8f8e7ba053475833fc833 --- diff --git a/manifest b/manifest index 1bfafba7d2..d3ac634025 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\scompiler\swarnings\swith\sMSVC\sbuild.\s(CVS\s6741) -D 2009-06-09T18:58:53 +C Remove\sthe\sactual\schecks\sthat\sverify\sthat\smemory\spools\s(such\sas\sset\sup\nusing\sSQLITE_CONFIG_HEAP)\sare\s8-byte\saligned.\s\sBut\sdocument\sthat\s8-byte\nalignment\sis\srequired.\s(CVS\s6742) +D 2009-06-09T19:53:58 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 8b8fb7823264331210cddf103831816c286ba446 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -125,7 +125,7 @@ F src/insert.c 69ef88ce30d1f65315b57aba63b2d4e9bdca1090 F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0 F src/legacy.c 9a56cf126ceee332b56061bf16bd0fb4ff9e26c0 F src/loadext.c 0e88a335665db0b2fb4cece3e49dcb65d832635a -F src/main.c 839ebfc7fa3b5a9f36223f536f6b5fef2a5ecf63 +F src/main.c a30a4a7faaefb3dbceee60f80caf985f2f38b3ea F src/malloc.c 7b3b6423f5b355e5d649b91e16ef252d610bcf19 F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270 @@ -160,7 +160,7 @@ F src/resolve.c f86d3490cf93a12f8a451720defc622cbc79873a F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f F src/select.c 2d97084a176a63eabce2d043eb4fbb13c46d6e9f F src/shell.c db2643650b9268df89a4bedca3f1c6d9e786f1bb -F src/sqlite.h.in e23556112022f04c9c49a4fc9871be16223250c3 +F src/sqlite.h.in 9fe53ec7a8310d7d18d482b85e46f5556abfd1de F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 F src/sqliteInt.h f8d70341d527404c5f162dc7fcc0f005700d0b48 F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d @@ -733,7 +733,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 -P 9d3329891c2227a1a3ded1c636ac615864010ca7 -R 29a13eb275900e63ac826d07275d5f9d -U shane -Z a716d3bc3c26080c0aad9adc8101d4dd +P 0bd84e7387802c58c820369ff27ef54adbdf2e96 +R 29fe22cf8f8068919f8b856eca0fa3af +U drh +Z 046c2b0883806c0e583e778b10e1f950 diff --git a/manifest.uuid b/manifest.uuid index 99da59120a..3a7e3e4a81 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0bd84e7387802c58c820369ff27ef54adbdf2e96 \ No newline at end of file +e9b55ccc8b6d4f21c9c8f8e7ba053475833fc833 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 671dc356f8..fa1c3b5e80 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.556 2009/06/09 18:02:10 drh Exp $ +** $Id: main.c,v 1.557 2009/06/09 19:53:58 drh Exp $ */ #include "sqliteInt.h" @@ -338,11 +338,6 @@ int sqlite3_config(int op, ...){ sqlite3GlobalConfig.nHeap = va_arg(ap, int); sqlite3GlobalConfig.mnReq = va_arg(ap, int); - /* Must have 8-byte alignment */ - if( ((sqlite3GlobalConfig.pHeap - (char*)0)&7)!=0 ){ - return SQLITE_MISUSE; - } - if( sqlite3GlobalConfig.pHeap==0 ){ /* If the heap pointer is NULL, then restore the malloc implementation ** back to NULL pointers too. This will cause the malloc to go diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 31cc5b2166..c199546e84 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -30,7 +30,7 @@ ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** -** @(#) $Id: sqlite.h.in,v 1.456 2009/06/09 18:02:10 drh Exp $ +** @(#) $Id: sqlite.h.in,v 1.457 2009/06/09 19:53:58 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -1036,12 +1036,14 @@ struct sqlite3_mem_methods { ** **
SQLITE_CONFIG_SCRATCH
**
This option specifies a static memory buffer that SQLite can use for -** scratch memory. There are three arguments: A pointer to the memory, the -** size of each scratch buffer (sz), and the number of buffers (N). The sz +** scratch memory. There are three arguments: A pointer an 8-byte +** aligned memory buffer from which the scrach allocations will be +** drawn, the size of each scratch allocation (sz), +** and the maximum number of scratch allocations (N). The sz ** argument must be a multiple of 16. The sz parameter should be a few bytes -** larger than the actual scratch space required due internal overhead. -** The first -** argument should point to an allocation of at least sz*N bytes of memory. +** larger than the actual scratch space required due to internal overhead. +** The first argument should pointer to an 8-byte aligned buffer +** of at least sz*N bytes of memory. ** SQLite will use no more than one scratch buffer at once per thread, so ** N should be set to the expected maximum number of threads. The sz ** parameter should be 6 times the size of the largest database page size. @@ -1055,31 +1057,37 @@ struct sqlite3_mem_methods { ** the database page cache with the default page cache implemenation. ** This configuration should not be used if an application-define page ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option. -** There are three arguments to this option: A pointer to the +** There are three arguments to this option: A pointer to 8-byte aligned ** memory, the size of each page buffer (sz), and the number of pages (N). -** The sz argument must be a power of two between 512 and 32768. The first +** The sz argument should be the size of the largest database page +** (a power of two between 512 and 32768) plus a little extra for each +** page header. The page header size is 20 to 40 bytes depending on +** the host architecture. It is harmless, apart from the wasted memory, +** to make sz a little too large. The first ** argument should point to an allocation of at least sz*N bytes of memory. ** SQLite will use the memory provided by the first argument to satisfy its ** memory needs for the first N pages that it adds to cache. If additional ** page cache memory is needed beyond what is provided by this option, then ** SQLite goes to [sqlite3_malloc()] for the additional storage space. ** The implementation might use one or more of the N buffers to hold -** memory accounting information.
+** memory accounting information. The pointer in the first argument must +** be aligned to an 8-byte boundary or subsequent behavior of SQLite +** will be undefined. ** **
SQLITE_CONFIG_HEAP
**
This option specifies a static memory buffer that SQLite will use ** for all of its dynamic memory allocation needs beyond those provided ** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE]. -** There are three arguments: A pointer to the memory, the number of -** bytes in the memory buffer, and the minimum allocation size. If -** the first pointer (the memory pointer) is NULL, then SQLite reverts +** There are three arguments: An 8-byte aligned pointer to the memory, +** the number of bytes in the memory buffer, and the minimum allocation size. +** If the first pointer (the memory pointer) is NULL, then SQLite reverts ** to using its default memory allocator (the system malloc() implementation), ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. If the ** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or ** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory ** allocator is engaged to handle all of SQLites memory allocation needs. ** The first pointer (the memory pointer) must be aligned to an 8-byte -** boundary or the behavior is undefined.
+** boundary or subsequent behavior of SQLite will be undefined. ** **
SQLITE_CONFIG_MUTEX
**
This option takes a single argument which is a pointer to an @@ -1150,9 +1158,9 @@ struct sqlite3_mem_methods { **
This option takes three additional arguments that determine the ** [lookaside memory allocator] configuration for the [database connection]. ** The first argument (the third parameter to [sqlite3_db_config()] is a -** pointer to a memory buffer to use for lookaside memory. The first -** argument may be NULL in which case SQLite will allocate the lookaside -** buffer itself using [sqlite3_malloc()]. The second argument is the +** pointer to an 8-byte aligned memory buffer to use for lookaside memory. +** The first argument may be NULL in which case SQLite will allocate the +** lookaside buffer itself using [sqlite3_malloc()]. The second argument is the ** size of each lookaside buffer slot and the third argument is the number of ** slots. The size of the buffer in the first argument must be greater than ** or equal to the product of the second and third arguments.