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

Modify sqlite3_release_memory() to use a global LRU list of pages. Untested. (CVS 4301)

FossilOrigin-Name: 5626ce0b5e249d48b56fdc4561ef663941eb23dc
This commit is contained in:
danielk1977
2007-08-27 17:27:49 +00:00
parent 4b6b4ab0d2
commit 9f61c2f129
5 changed files with 213 additions and 144 deletions

View File

@@ -12,7 +12,7 @@
** This file contains the C functions that implement mutexes for
** use by the SQLite core.
**
** $Id: mutex.c,v 1.13 2007/08/25 16:31:30 drh Exp $
** $Id: mutex.c,v 1.14 2007/08/27 17:27:49 danielk1977 Exp $
*/
/*
** If SQLITE_MUTEX_APPDEF is defined, then this whole module is
@@ -253,6 +253,7 @@ struct sqlite3_mutex {
** <li> SQLITE_MUTEX_STATIC_MEM
** <li> SQLITE_MUTEX_STATIC_MEM2
** <li> SQLITE_MUTEX_STATIC_PRNG
** <li> SQLITE_MUTEX_STATIC_LRU
** </ul>
**
** The first two constants cause sqlite3_mutex_alloc() to create
@@ -285,6 +286,7 @@ sqlite3_mutex *sqlite3_mutex_alloc(int iType){
{ PTHREAD_MUTEX_INITIALIZER, },
{ PTHREAD_MUTEX_INITIALIZER, },
{ PTHREAD_MUTEX_INITIALIZER, },
{ PTHREAD_MUTEX_INITIALIZER, },
};
sqlite3_mutex *p;
switch( iType ){
@@ -474,7 +476,7 @@ sqlite3_mutex *sqlite3_mutex_alloc(int iType){
break;
}
default: {
static sqlite3_mutex staticMutexes[4];
static sqlite3_mutex staticMutexes[5];
static int isInit = 0;
while( !isInit ){
static long lock = 0;