1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

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
This commit is contained in:
danielk1977
2008-08-21 12:19:44 +00:00
parent 0d3c5d3239
commit 67e3da7ad4
9 changed files with 141 additions and 105 deletions

View File

@@ -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.
*/