aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-05-23 01:40:53 +0000
committerdrh <drh@noemail.net>2013-05-23 01:40:53 +0000
commit34e258c942f033d623bb559a0d7dbcd64246d30e (patch)
tree97fa8ed27cba32f79ffd822f9fe3879bfb10352e /src/os_unix.c
parentd399fb3de8c1a0b6e4bf995e22d07dce6218e22c (diff)
downloadsqlite-34e258c942f033d623bb559a0d7dbcd64246d30e.tar.gz
sqlite-34e258c942f033d623bb559a0d7dbcd64246d30e.zip
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
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index abc23a452..242c2a3c3 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -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