-C Do\snot\sread\sthe\slast\spage\sof\sa\soverflow\schain\swhen\sdeleting\sthat\schain.\r\nJust\sadd\sthe\spage\sto\sthe\sfreelist.\s\sThis\sreduces\sI/O.\s(CVS\s3672)
-D 2007-03-06T11:42:19
+C Use\sheap\sinstead\sof\sstack\sfor\slarge\sbuffers\sin\sthe\spager.\sFix\sfor\s#2262.\s(CVS\s3673)
+D 2007-03-06T13:46:00
F Makefile.in 1fe3d0b46e40fd684e1e61f8e8056cefed16de9f
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c 8736cf3a49fd651a6538857480f302807d57814c
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c c78d1cc1a02d9c6ab3263c3ca757e4466973fa2a
+F src/pager.c 680bf115aa1678a011ce046f2a1ef4cad45576cb
F src/pager.h 8881591ca23d1e5fd83c95fa8317245fbcf64227
F src/parse.y bcfe366c1fd61cfc40e5344eb69a31997a821af0
F src/pragma.c 5091300911670ddaa552bfa12c45cbca1bb7e7d6
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 2ba5be311945a4c15b6dce7c01efefb513b9a973
-R b6b1462461ede272fb76bf4d7e144940
-U drh
-Z ecb4e965eec3f8ba87257a871ce271b7
+P 6db945f7a7587c8c7adada92f94ac7936b901cf1
+R fd445e52d946f4b2dccfd0401e136fcc
+U danielk1977
+Z 899687d498719bea31167b023df14d79
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.285 2007/03/04 13:15:28 drh Exp $
+** @(#) $Id: pager.c,v 1.286 2007/03/06 13:46:00 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
Pager *pNext; /* Linked list of pagers in this thread */
#endif
+ char *pTmpSpace; /* Pager.pageSize bytes of space for tmp use */
};
/*
PgHdr *pPg; /* An existing page in the cache */
Pgno pgno; /* The page number of a page in journal */
u32 cksum; /* Checksum used for sanity checking */
- u8 aData[SQLITE_MAX_PAGE_SIZE]; /* Temp storage for a page */
+ u8 *aData = (u8 *)pPager->pTmpSpace; /* Temp storage for a page */
/* useCksum should be true for the main journal and false for
** statement journals. Verify that this is always the case
*/
assert( jfd == (useCksum ? pPager->jfd : pPager->stfd) );
-
+ assert( aData );
rc = read32bits(jfd, &pgno);
if( rc!=SQLITE_OK ) return rc;
- rc = sqlite3OsRead(jfd, &aData, pPager->pageSize);
+ rc = sqlite3OsRead(jfd, aData, pPager->pageSize);
if( rc!=SQLITE_OK ) return rc;
pPager->journalOff += pPager->pageSize + 4;
PgHdr *pPg;
int rc = SQLITE_OK;
for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
- char zBuf[SQLITE_MAX_PAGE_SIZE];
+ char *zBuf = pPager->pTmpSpace; /* Temp storage for one page */
if( !pPg->dirty ) continue;
if( (int)pPg->pgno <= pPager->origDbSize ){
rc = sqlite3OsSeek(pPager->fd, pPager->pageSize*(i64)(pPg->pgno-1));
if( zFullPathname ){
nameLen = strlen(zFullPathname);
pPager = sqliteMalloc( sizeof(*pPager) + nameLen*3 + 30 );
+ if( pPager && rc==SQLITE_OK ){
+ pPager->pTmpSpace = (char *)sqliteMallocRaw(SQLITE_DEFAULT_PAGE_SIZE);
+ }
}
+
/* If an error occured in either of the blocks above, free the memory
** pointed to by zFullPathname, free the Pager structure and close the
** file. Since the pager is not allocated there is no need to set
** any Pager.errMask variables.
*/
- if( !pPager || !zFullPathname || rc!=SQLITE_OK ){
+ if( !pPager || !zFullPathname || !pPager->pTmpSpace || rc!=SQLITE_OK ){
sqlite3OsClose(&fd);
sqliteFree(zFullPathname);
sqliteFree(pPager);
assert( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE );
if( !pPager->memDb ){
pPager->pageSize = pageSize;
+ sqlite3ReallocOrFree((void **)&pPager->pTmpSpace, pageSize);
}
return pPager->pageSize;
}
}
#endif
sqliteFree(pPager->aHash);
+ sqliteFree(pPager->pTmpSpace);
sqliteFree(pPager);
return SQLITE_OK;
}