1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Disable automatic invocation of sqlite3_release_memory() when a malloc() fails

in those cases where the global mutex is held. (CVS 2860)

FossilOrigin-Name: 6fdbb8b771e490f0d791326689245302c4fe18f5
This commit is contained in:
danielk1977
2006-01-05 13:48:29 +00:00
parent da18423620
commit 441b09ae55
7 changed files with 57 additions and 45 deletions

View File

@@ -18,7 +18,7 @@
** 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"
@@ -2460,6 +2460,16 @@ int sqlite3pager_release_memory(int nReq){
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