diff options
author | drh <drh@noemail.net> | 2007-06-15 20:29:20 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-06-15 20:29:20 +0000 |
commit | 7d7f17b6a827d839a8d388d6bd6a55499c71ee2d (patch) | |
tree | 708d6ff8705c5146d396e2c2d79458f6b9d6982d /src/malloc.c | |
parent | 341ae48332c118cb6ebdbcdbe4679649968ea63f (diff) | |
download | sqlite-7d7f17b6a827d839a8d388d6bd6a55499c71ee2d.tar.gz sqlite-7d7f17b6a827d839a8d388d6bd6a55499c71ee2d.zip |
Make arrangements to optionally print a debug message at the point
of a simulated malloc() failure when SQLITE_MEMDEBUG is defined. (CVS 4077)
FossilOrigin-Name: 7d3c1f08a34fcf2ca5c79d6e58f713ae6a4b34e8
Diffstat (limited to 'src/malloc.c')
-rw-r--r-- | src/malloc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/malloc.c b/src/malloc.c index e8124a34d..2ae3a55ad 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -12,7 +12,7 @@ ** Memory allocation functions used throughout sqlite. ** ** -** $Id: malloc.c,v 1.2 2007/05/16 17:28:43 danielk1977 Exp $ +** $Id: malloc.c,v 1.3 2007/06/15 20:29:20 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -203,6 +203,7 @@ int sqlite3_mallocDisallowed = 0; /* assert() in sqlite3Malloc() if set */ int sqlite3_isFail = 0; /* True if all malloc calls should fail */ const char *sqlite3_zFile = 0; /* Filename to associate debug info with */ int sqlite3_iLine = 0; /* Line number for debug info */ +int sqlite3_mallocfail_trace = 0; /* Print a msg on malloc fail if true */ /* ** Check for a simulated memory allocation failure. Return true if @@ -217,6 +218,9 @@ int sqlite3TestMallocFail(){ if( sqlite3_iMallocFail==0 ){ sqlite3_iMallocFail = sqlite3_iMallocReset; sqlite3_isFail = 1; + if( sqlite3_mallocfail_trace ){ + sqlite3DebugPrintf("###_malloc_fails_###\n"); + } return 1; } } |