-C Add\sthe\sshared\sschema/pager\smodifications.\sVery\sfew\stests\sso\sfar.\s(CVS\s2859)
-D 2006-01-05T11:34:33
+C Disable\sautomatic\sinvocation\sof\ssqlite3_release_memory()\swhen\sa\smalloc()\sfails\nin\sthose\scases\swhere\sthe\sglobal\smutex\sis\sheld.\s(CVS\s2860)
+D 2006-01-05T13:48:29
F Makefile.in e3c6b3a38d734d41574c04f2fc90d18de2b87102
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
F src/insert.c d167f9d41932ddaff9162f116e2abc514b0680b6
F src/legacy.c 59757d857ab95fcbb0ac27692d3201e35f093dd7
-F src/main.c 3a9689e4127ad7d4d417ff4e0bed2dd2b76ea445
+F src/main.c c1d8d2022a65104c847880882fbce9ba32381530
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
F src/os.c 7b4a002d9c9421580276db55d2329636a604e8ef
F src/os.h cc99e1515696728ba64c77fffa781ebadea34619
F src/os_common.h d0b1f2f32926e9b6db7886a7f43008b596a9e926
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
-F src/os_unix.c e4fbf1370e1a03875ebb3239316fa8eb8476258b
+F src/os_unix.c d52d87a06ce62c7c6b9f7dcb7da1248737397765
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c 7e2d09f81cb83709b9774ac6be80fa3cb08ac86d
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c 681b4e39d581ead8fd54283176138bec924a4bae
+F src/pager.c 07509ddb478f5a70f9ff53607ab8a44456c22811
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
F src/parse.y 58258759fabdd48f1d2561e276097290b1ea2680
F src/pragma.c 4af4041a88d41421b8ff2e5574d82d7b9d1e35b1
F src/select.c 7a78520fcd79daccd4e33721dbc977d2e5c5d95a
F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da
F src/sqlite.h.in ba3a29daa6a16e054191ccb384a981964e882a1d
-F src/sqliteInt.h 5117ce283868de7010e62ec1a80ce1162575c184
+F src/sqliteInt.h 6f29c97703b1a1e032916b0bab83efe9b2734984
F src/table.c 486dcfce532685b53b5a2b5da8bba0ded6fb2316
F src/tclsqlite.c 0386460a4c017d49d729d44cdcb3fb3ffb2503e0
F src/test1.c 988dbac66c3ca92d69fbe0283d77e86cd6f73ce8
F src/vdbemem.c deba8d6e3727643924b210a8c531a496c2b8d386
F src/where.c 3ec45076e7cce523aad34eaf9bd119237b56942a
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
-F test/all.test 18602f8cd97d5741574dee7288e1f5f427f12825
+F test/all.test 90cf64bb655e3d474b0dda04e63ece03e36b0ce2
F test/alter.test b94b640063e725d062b2997bd2810ac39195c718
F test/alter2.test cc0b8832e4e98605dbc26910efd4bb89abe59cb2
F test/alter3.test 6e144ea3dcc395afcc28e794bb532be83dc8fdcb
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P cb9095ac52e76926f274678ef55ebb9df4b9fcac
-R a8dde2ab271da0ac5619066fd6022d05
+P deeda0dc06c1595aedd8d06a0c4e88a8abf78cf7
+R 9d12b452805846233d53c41b43a70bb0
U danielk1977
-Z 0d100378c01552c949846ec200b31003
+Z f6fa8bc04dbc256a46d97346ce8d34cd
-deeda0dc06c1595aedd8d06a0c4e88a8abf78cf7
\ No newline at end of file
+6fdbb8b771e490f0d791326689245302c4fe18f5
\ No newline at end of file
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.314 2006/01/05 11:34:34 danielk1977 Exp $
+** $Id: main.c,v 1.315 2006/01/05 13:48:29 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
sqlite3ValueFree(db->pErr);
}
-#if 0
-#ifndef SQLITE_OMIT_GLOBALRECOVER
- {
- sqlite3 *pPrev;
- sqlite3Os.xEnterMutex();
- pPrev = pDbList;
- while( pPrev && pPrev->pNext!=db ){
- pPrev = pPrev->pNext;
- }
- if( pPrev ){
- pPrev->pNext = db->pNext;
- }else{
- assert( pDbList==db );
- pDbList = db->pNext;
- }
- sqlite3Os.xLeaveMutex();
- }
-#endif
-#endif
-
db->magic = SQLITE_MAGIC_ERROR;
sqliteFree(db->aDb[1].pSchema);
sqliteFree(db);
struct stat statbuf;
struct lockInfo *pLock;
struct openCnt *pOpen;
+ SqliteTsd *pTsd = sqlite3Tsd();
rc = fstat(fd, &statbuf);
if( rc!=0 ) return 1;
+
+ /* Disable the sqlite3_release_memory() function */
+ assert( !pTsd->disableReleaseMemory );
+ pTsd->disableReleaseMemory = 1;
+
memset(&key1, 0, sizeof(key1));
key1.dev = statbuf.st_dev;
key1.ino = statbuf.st_ino;
if( pLock==0 ){
struct lockInfo *pOld;
pLock = sqliteMallocRaw( sizeof(*pLock) );
- if( pLock==0 ) return 1;
+ if( pLock==0 ){
+ rc = 1;
+ goto exit_findlockinfo;
+ }
pLock->key = key1;
pLock->nRef = 1;
pLock->cnt = 0;
if( pOld!=0 ){
assert( pOld==pLock );
sqliteFree(pLock);
- return 1;
+ rc = 1;
+ goto exit_findlockinfo;
}
}else{
pLock->nRef++;
pOpen = sqliteMallocRaw( sizeof(*pOpen) );
if( pOpen==0 ){
releaseLockInfo(pLock);
- return 1;
+ rc = 1;
+ goto exit_findlockinfo;
}
pOpen->key = key2;
pOpen->nRef = 1;
assert( pOld==pOpen );
sqliteFree(pOpen);
releaseLockInfo(pLock);
- return 1;
+ rc = 1;
+ goto exit_findlockinfo;
}
}else{
pOpen->nRef++;
}
*ppOpen = pOpen;
- return 0;
+
+exit_findlockinfo:
+ /* Re-enable sqlite3_release_memory() */
+ pTsd->disableReleaseMemory = 0;
+ return rc;
}
/*
** Close a file.
*/
static int unixClose(OsFile **pId){
+ SqliteTsd *pTsd = sqlite3Tsd();
unixFile *id = (unixFile*)*pId;
if( !id ) return SQLITE_OK;
if( CHECK_THREADID(id) ) return SQLITE_MISUSE;
if( id->dirfd>=0 ) close(id->dirfd);
id->dirfd = -1;
sqlite3Os.xEnterMutex();
+
+ /* Disable the sqlite3_release_memory() function */
+ assert( !pTsd->disableReleaseMemory );
+ pTsd->disableReleaseMemory = 1;
+
if( id->pOpen->nLock ){
/* If there are outstanding locks, do not actually close the file just
** yet because that would clear those locks. Instead, add the file
}
releaseLockInfo(id->pLock);
releaseOpenCnt(id->pOpen);
+
+ /* Disable the sqlite3_release_memory() function */
+ pTsd->disableReleaseMemory = 0;
+
sqlite3Os.xLeaveMutex();
id->isOpen = 0;
TRACE2("CLOSE %-3d\n", id->h);
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.229 2005/12/30 16:28:02 danielk1977 Exp $
+** @(#) $Id: pager.c,v 1.230 2006/01/05 13:48:29 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
int nReleased = 0;
int i;
+ /* If the disableReleaseMemory memory flag is set, this operation is
+ ** a no-op; zero bytes of memory are freed. The flag is set before
+ ** malloc() is called while the global mutex (see sqlite3Os.xEnterMutex)
+ ** is held. Because some of the code invoked by this function may also
+ ** try to obtain the mutex, proceding may cause a deadlock.
+ */
+ if( pTsd->disableReleaseMemory ){
+ return 0;
+ }
+
/* Outermost loop runs for at most two iterations. First iteration we
** try to find memory that can be released without calling fsync(). Second
** iteration (which only runs if the first failed to free nReq bytes of
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.448 2006/01/05 11:34:34 danielk1977 Exp $
+** @(#) $Id: sqliteInt.h,v 1.449 2006/01/05 13:48:29 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
struct SqliteTsd {
u8 isInit; /* True if structure has been initialised */
u8 mallocFailed; /* True after a malloc() has failed */
+ u8 disableReleaseMemory; /* True to make sqlite3_release_memory() a no-op */
#ifndef SQLITE_OMIT_MEMORY_MANAGEMENT
i64 nSoftHeapLimit; /* -ve for unlimited */
#***********************************************************************
# This file runs all tests.
#
-# $Id: all.test,v 1.32 2006/01/05 11:34:34 danielk1977 Exp $
+# $Id: all.test,v 1.33 2006/01/05 13:48:29 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
malloc.test
misuse.test
memleak.test
-
- malloc2.test
- malloc3.test
- malloc4.test
- malloc5.test
}
# Test files btree2.test and btree4.test don't work if the