1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Add the sqlite3_db_release_memory() interface and the shrink_memory pragma.

FossilOrigin-Name: 3f58e7c8895d1252eff56282c08b1a6f1194452c
This commit is contained in:
drh
2011-11-16 19:29:17 +00:00
parent 870c0178f7
commit 09419b4bae
12 changed files with 181 additions and 21 deletions

View File

@@ -530,6 +530,24 @@ sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){
return db->mutex;
}
/*
** Free up as much memory as we can from the given database
** connection.
*/
int sqlite3_db_release_memory(sqlite3 *db){
int i;
sqlite3BtreeEnterAll(db);
for(i=0; i<db->nDb; i++){
Btree *pBt = db->aDb[i].pBt;
if( pBt ){
Pager *pPager = sqlite3BtreePager(pBt);
sqlite3PagerShrink(pPager);
}
}
sqlite3BtreeLeaveAll(db);
return SQLITE_OK;
}
/*
** Configuration settings for an individual database connection
*/