diff options
author | danielk1977 <danielk1977@noemail.net> | 2008-08-21 12:19:44 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2008-08-21 12:19:44 +0000 |
commit | 67e3da7ad43b63ff9efbb69565aae4ec87cf0941 (patch) | |
tree | e2b68d949e64099ab52787b7ba331ef9730062e3 /src/pager.c | |
parent | 0d3c5d3239a658aaff40b86f5c5c7c2e64b21dc3 (diff) | |
download | sqlite-67e3da7ad43b63ff9efbb69565aae4ec87cf0941.tar.gz sqlite-67e3da7ad43b63ff9efbb69565aae4ec87cf0941.zip |
Fix the functionality associated with sqlite3_release_memory() and sqlite3_soft_heap_limit(). It is automatically disabled if the SQLITE_CONFIG_PAGECACHE option is used. (CVS 5576)
FossilOrigin-Name: d025866b09352b32a6d35b97144eaad2fafb7165
Diffstat (limited to 'src/pager.c')
-rw-r--r-- | src/pager.c | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/src/pager.c b/src/pager.c index 1c56a7a8f..b9a71c0a0 100644 --- a/src/pager.c +++ b/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.472 2008/08/21 04:35:19 danielk1977 Exp $ +** @(#) $Id: pager.c,v 1.473 2008/08/21 12:19:44 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -2453,22 +2453,26 @@ static int pagerStress(void *p){ PgHdr *pPg = sqlite3PcacheDirtyPage(pPager->pPCache); int rc = SQLITE_OK; - if( pPg && pPager->errCode==SQLITE_OK ){ + if( pPg ){ assert( pPg->flags&PGHDR_DIRTY ); - if( pPg->flags&PGHDR_NEED_SYNC ){ - rc = syncJournal(pPager); - if( rc==SQLITE_OK && pPager->fullSync - && !(sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND) - ){ - pPager->nRec = 0; - rc = writeJournalHdr(pPager); + if( pPager->errCode==SQLITE_OK ){ + if( pPg->flags&PGHDR_NEED_SYNC ){ + rc = syncJournal(pPager); + if( rc==SQLITE_OK && pPager->fullSync && + !(sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND) + ){ + pPager->nRec = 0; + rc = writeJournalHdr(pPager); + } } - } - if( rc==SQLITE_OK ){ - rc = pager_write_pagelist(pPg); - } - if( rc!=SQLITE_OK ){ - pager_error(pPager, rc); + if( rc==SQLITE_OK ){ + rc = pager_write_pagelist(pPg); + } + if( rc!=SQLITE_OK ){ + pager_error(pPager, rc); + } + }else{ + sqlite3PcacheMakeClean(pPg); } } return rc; @@ -2523,21 +2527,6 @@ static int hasHotJournal(Pager *pPager, int *pExists){ return rc; } -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT -/* -** This function is called to free superfluous dynamically allocated memory -** held by the pager system. Memory in use by any SQLite pager allocated -** by the current thread may be sqlite3_free()ed. -** -** nReq is the number of bytes of memory required. Once this much has -** been released, the function returns. The return value is the total number -** of bytes of memory released. -*/ -int sqlite3PagerReleaseMemory(int nReq){ - return 0; -} -#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */ - /* ** Read the content of page pPg out of the database file. */ |