Make the Pager.pAll linked-list doubly linked when ENABLE_MEMORY_MANAGEMENT is defined. This is used to speed up sqlite3_release_memory(). (CVS 5346)
FossilOrigin-Name: 71d699de366fc9c97d4a5122e2bf754310b9b34a
This commit is contained in:
parent
8c4d5b252e
commit
21b7ce6151
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Fail\sto\sbuild\sif\sthe\s-ffast-math\soption\sis\sspecified\sin\sGCC.\r\nTicket\s#3202.\s(CVS\s5345)
|
||||
D 2008-07-06T00:21:35
|
||||
C Make\sthe\sPager.pAll\slinked-list\sdoubly\slinked\swhen\sENABLE_MEMORY_MANAGEMENT\sis\sdefined.\sThis\sis\sused\sto\sspeed\sup\ssqlite3_release_memory().\s(CVS\s5346)
|
||||
D 2008-07-07T11:18:28
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -133,7 +133,7 @@ F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
|
||||
F src/os_os2.c 38fd8cfb1c122c39e451d9f3e779c602283dba33
|
||||
F src/os_unix.c 3d19f0491e0b32e5b757c7e6f310f2f6d3aea3f4
|
||||
F src/os_win.c 2bf2f8cd700299564cc236262c2668e1e02c626a
|
||||
F src/pager.c e2a49872f1e15eb83895ace704c48ac8ded998ba
|
||||
F src/pager.c 4c4d0529a6546fda09e5703d4d3ec302c322fd6d
|
||||
F src/pager.h 6aa3050a3c684475a5a9dbad5ff1cebad612acba
|
||||
F src/parse.y 8c2c3145eebe1964eb279cb3c4e502eae28bb0fa
|
||||
F src/pragma.c 9a95f5b3708f6d3ddd987eab5f369a19ffcb6795
|
||||
@ -598,7 +598,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
P b8ff6b0a3dc2ccc51519c764a092822968a09b10
|
||||
R 1e8caeca3094e411c6ec680faf547d00
|
||||
U drh
|
||||
Z 8f3582bf1d287a7f6bf673d58093cb01
|
||||
P aa5be9ee935ae2a45d78405e26bba2385a52563a
|
||||
R ba63b313f2ed3563fe3f6099626bd2ff
|
||||
U danielk1977
|
||||
Z 80a3ac3ae369b1b5cd11402682d1b216
|
||||
|
@ -1 +1 @@
|
||||
aa5be9ee935ae2a45d78405e26bba2385a52563a
|
||||
71d699de366fc9c97d4a5122e2bf754310b9b34a
|
22
src/pager.c
22
src/pager.c
@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.460 2008/06/20 14:59:51 danielk1977 Exp $
|
||||
** @(#) $Id: pager.c,v 1.461 2008/07/07 11:18:28 danielk1977 Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
@ -269,6 +269,7 @@ struct PgHdr {
|
||||
short int nRef; /* Number of users of this page */
|
||||
PgHdr *pDirty, *pPrevDirty; /* Dirty pages */
|
||||
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
|
||||
PgHdr *pPrevAll; /* A list of all pages */
|
||||
PagerLruLink gfree; /* Global list of nRef==0 pages */
|
||||
#endif
|
||||
#ifdef SQLITE_CHECK_PAGES
|
||||
@ -3336,10 +3337,20 @@ int sqlite3PagerReleaseMemory(int nReq){
|
||||
PgHdr *pTmp;
|
||||
assert( pPg );
|
||||
if( pPg==pPager->pAll ){
|
||||
assert(pPg->pPrevAll==0);
|
||||
assert(pPg->pNextAll==0 || pPg->pNextAll->pPrevAll==pPg);
|
||||
pPager->pAll = pPg->pNextAll;
|
||||
if( pPager->pAll ){
|
||||
pPager->pAll->pPrevAll = 0;
|
||||
}
|
||||
}else{
|
||||
for( pTmp=pPager->pAll; pTmp->pNextAll!=pPg; pTmp=pTmp->pNextAll ){}
|
||||
pTmp->pNextAll = pPg->pNextAll;
|
||||
assert(pPg->pPrevAll);
|
||||
assert(pPg->pPrevAll->pNextAll==pPg);
|
||||
pTmp = pPg->pPrevAll;
|
||||
pTmp->pNextAll = pPg->pNextAll;
|
||||
if( pTmp->pNextAll ){
|
||||
pTmp->pNextAll->pPrevAll = pTmp;
|
||||
}
|
||||
}
|
||||
nReleased += (
|
||||
sizeof(*pPg) + pPager->pageSize
|
||||
@ -3665,6 +3676,11 @@ static int pagerAllocatePage(Pager *pPager, PgHdr **ppPg){
|
||||
pPg->pData = pData;
|
||||
pPg->pPager = pPager;
|
||||
pPg->pNextAll = pPager->pAll;
|
||||
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
|
||||
if( pPg->pNextAll ){
|
||||
pPg->pNextAll->pPrevAll = pPg;
|
||||
}
|
||||
#endif
|
||||
pPager->pAll = pPg;
|
||||
pPager->nPage++;
|
||||
}else{
|
||||
|
Loading…
x
Reference in New Issue
Block a user