1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Cause the mmap_size PRAGMA to immediately change the mmap space if the

database connection is already active.  In particular, reducing mmap_size
will immediately free up process address space.

FossilOrigin-Name: 761177927cb51e4f5e66061ca39cf37edbe8346b
This commit is contained in:
drh
2013-05-23 01:40:53 +00:00
parent d399fb3de8
commit 34e258c942
5 changed files with 127 additions and 17 deletions

View File

@@ -3775,15 +3775,19 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
}
case SQLITE_FCNTL_MMAP_SIZE: {
i64 newLimit = *(i64*)pArg;
int rc = SQLITE_OK;
if( newLimit>sqlite3GlobalConfig.mxMmap ){
newLimit = sqlite3GlobalConfig.mxMmap;
}
*(i64*)pArg = pFile->mmapSizeMax;
if( newLimit>=0 ){
if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
pFile->mmapSizeMax = newLimit;
if( newLimit<pFile->mmapSize ) pFile->mmapSize = newLimit;
if( pFile->mmapSize>0 ){
unixUnmapfile(pFile);
rc = unixMapfile(pFile, -1);
}
}
return SQLITE_OK;
return rc;
}
#ifdef SQLITE_DEBUG
/* The pager calls this method to signal that it has done