-C Changes\sto\sreduce\sthe\sheap\sspace\sconsumed\sby\striggers,\sviews\sand\stables\sin\sthe\sin-memory\srepresentation\sof\sthe\sschema.\sAlso\sto\sreduce\sthe\sspace\sused\sby\sprepared\sstatements\sslightly.\s(CVS\s6305)
-D 2009-02-19T14:39:25
+C Remove\scode\sin\smalloc.c\sthat\swas\salready\scommented\sout\susing\s#if\s0.\s(CVS\s6306)
+D 2009-02-19T20:50:15
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 1d83fa2b1fd326b9e121012bd1ff9740537e12b3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/legacy.c 8b3b95d48d202614946d7ce7256e7ba898905c3b
F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc
F src/main.c 4912460dab29e4d37e4ba1d78320c6a77bb95ad8
-F src/malloc.c 552d993ee414ead65cafcaa636e22c84085999cb
+F src/malloc.c 072ddad9b7e908e9b9a2a494d4758dadeced61ae
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
F src/mem1.c 3bfb39e4f60b0179713a7c087b2d4f0dc205735f
F src/mem2.c 692c5b50141f49c32d85d7c0c39c751f6d520093
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P ded04f12f41504e4a3ecd5164f0d4cbbde5e16f7
-R beea4442dc6507223c6db2a960f9f40a
-U danielk1977
-Z 5a9e5027f061557095d1ee54ae664ed7
+P d9f6ffbc5ea090ba0daac571fc9a6c68b9c864e4
+R 71113436f434e40594eca0b6cc7e07b2
+U drh
+Z 7f8f808d7025e6cd7278ce47c4e4464a
**
** Memory allocation functions used throughout sqlite.
**
-** $Id: malloc.c,v 1.56 2009/02/17 18:37:29 drh Exp $
+** $Id: malloc.c,v 1.57 2009/02/19 20:50:15 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
}
}
-/*
-** Allocate memory to be used by the page cache. Make use of the
-** memory buffer provided by SQLITE_CONFIG_PAGECACHE if there is one
-** and that memory is of the right size and is not completely
-** consumed. Otherwise, failover to sqlite3Malloc().
-*/
-#if 0
-void *sqlite3PageMalloc(int n){
- void *p;
- assert( n>0 );
- assert( (n & (n-1))==0 );
- assert( n>=512 && n<=32768 );
-
- if( sqlite3GlobalConfig.szPage<n ){
- goto page_overflow;
- }else{
- sqlite3_mutex_enter(mem0.mutex);
- if( mem0.nPageFree==0 ){
- sqlite3_mutex_leave(mem0.mutex);
- goto page_overflow;
- }else{
- int i;
- i = mem0.aPageFree[--mem0.nPageFree];
- sqlite3_mutex_leave(mem0.mutex);
- i *= sqlite3GlobalConfig.szPage;
- sqlite3StatusSet(SQLITE_STATUS_PAGECACHE_SIZE, n);
- sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_USED, 1);
- p = (void*)&((char*)sqlite3GlobalConfig.pPage)[i];
- }
- }
- return p;
-
-page_overflow:
- if( sqlite3GlobalConfig.bMemstat ){
- sqlite3_mutex_enter(mem0.mutex);
- sqlite3StatusSet(SQLITE_STATUS_PAGECACHE_SIZE, n);
- n = mallocWithAlarm(n, &p);
- if( p ) sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, n);
- sqlite3_mutex_leave(mem0.mutex);
- }else{
- p = sqlite3GlobalConfig.m.xMalloc(n);
- }
- return p;
-}
-void sqlite3PageFree(void *p){
- if( p ){
- if( sqlite3GlobalConfig.pPage==0
- || p<sqlite3GlobalConfig.pPage
- || p>=(void*)mem0.aPageFree ){
- /* In this case, the page allocation was obtained from a regular
- ** call to sqlite3_mem_methods.xMalloc() (a page-cache-memory
- ** "overflow"). Free the block with sqlite3_mem_methods.xFree().
- */
- if( sqlite3GlobalConfig.bMemstat ){
- int iSize = sqlite3MallocSize(p);
- sqlite3_mutex_enter(mem0.mutex);
- sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, -iSize);
- sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -iSize);
- sqlite3GlobalConfig.m.xFree(p);
- sqlite3_mutex_leave(mem0.mutex);
- }else{
- sqlite3GlobalConfig.m.xFree(p);
- }
- }else{
- /* The page allocation was allocated from the sqlite3GlobalConfig.pPage
- ** buffer. In this case all that is add the index of the page in
- ** the sqlite3GlobalConfig.pPage array to the set of free indexes stored
- ** in the mem0.aPageFree[] array.
- */
- int i;
- i = (u8 *)p - (u8 *)sqlite3GlobalConfig.pPage;
- i /= sqlite3GlobalConfig.szPage;
- assert( i>=0 && i<sqlite3GlobalConfig.nPage );
- sqlite3_mutex_enter(mem0.mutex);
- assert( mem0.nPageFree<sqlite3GlobalConfig.nPage );
- mem0.aPageFree[mem0.nPageFree++] = i;
- sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_USED, -1);
- sqlite3_mutex_leave(mem0.mutex);
-#if !defined(NDEBUG) && 0
- /* Assert that a duplicate was not just inserted into aPageFree[]. */
- for(i=0; i<mem0.nPageFree-1; i++){
- assert( mem0.aPageFree[i]!=mem0.aPageFree[mem0.nPageFree-1] );
- }
-#endif
- }
- }
-}
-#endif
-
/*
** TRUE if p is a lookaside memory allocation from db
*/