diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/util.c b/src/util.c index 03c0b6623..776f5db78 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.157 2005/12/20 09:19:37 danielk1977 Exp $ +** $Id: util.c,v 1.158 2005/12/20 14:38:00 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -66,6 +66,30 @@ #define MAX(x,y) ((x)>(y)?(x):(y)) +#ifndef SQLITE_OMIT_MEMORY_MANAGEMENT +/* +** Set the soft heap-size limit for the current thread. Passing a negative +** value indicates no limit. +*/ +void sqlite3_soft_heap_limit(sqlite_int64 n){ + sqlite3Tsd()->nSoftHeapLimit = n; +} + +/* +** Release memory held by SQLite instances created by the current thread. +*/ +int sqlite3_release_memory(int n){ + return sqlite3pager_release_memory(n); +} +#else +/* If SQLITE_OMIT_MEMORY_MANAGEMENT is defined, then define a version +** of sqlite3_release_memory() to be used by other code in this file. +** This is done for no better reason than to reduce the number of +** pre-processor #ifndef statements. +*/ +#define sqlite3_release_memory(x) 0 /* 0 == no memory freed */ +#endif + #ifdef SQLITE_MEMDEBUG /*-------------------------------------------------------------------------- ** Begin code for memory allocation system test layer. @@ -155,30 +179,6 @@ const char *sqlite3_malloc_id = 0; ) -#ifndef SQLITE_OMIT_MEMORY_MANAGEMENT -/* -** Set the soft heap-size limit for the current thread. Passing a negative -** value indicates no limit. -*/ -void sqlite3_soft_heap_limit(sqlite_int64 n){ - sqlite3Tsd()->nSoftHeapLimit = n; -} - -/* -** Release memory held by SQLite instances created by the current thread. -*/ -int sqlite3_release_memory(int n){ - return sqlite3pager_release_memory(n); -} -#else -/* If SQLITE_OMIT_MEMORY_MANAGEMENT is defined, then define a version -** of sqlite3_release_memory() to be used by other code in this file. -** This is done for no better reason than to reduce the number of -** pre-processor #ifndef statements. -*/ -#define sqlite3_release_memory(x) 0 /* 0 == no memory freed */ -#endif - /* ** For keeping track of the number of mallocs and frees. This ** is used to check for memory leaks. The iMallocFail and iMallocReset |