diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/malloc.c | 12 | ||||
-rw-r--r-- | src/mem3.c | 18 | ||||
-rw-r--r-- | src/mem5.c | 23 | ||||
-rw-r--r-- | src/mem6.c | 4 |
4 files changed, 23 insertions, 34 deletions
diff --git a/src/malloc.c b/src/malloc.c index 1fc8b4f93..61e1c1dbf 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -12,7 +12,7 @@ ** ** Memory allocation functions used throughout sqlite. ** -** $Id: malloc.c,v 1.39 2008/09/02 10:22:01 danielk1977 Exp $ +** $Id: malloc.c,v 1.40 2008/09/02 17:52:52 danielk1977 Exp $ */ #include "sqliteInt.h" #include <stdarg.h> @@ -77,6 +77,10 @@ int sqlite3_release_memory(int n){ ** State information local to the memory allocation subsystem. */ static SQLITE_WSD struct Mem0Global { + /* Number of free pages for scratch and page-cache memory */ + u32 nScratchFree; + u32 nPageFree; + sqlite3_mutex *mutex; /* Mutex to serialize access */ /* @@ -98,11 +102,7 @@ static SQLITE_WSD struct Mem0Global { */ u32 *aScratchFree; u32 *aPageFree; - - /* Number of free pages for scratch and page-cache memory */ - u32 nScratchFree; - u32 nPageFree; -} mem0 = {}; +} mem0 = { 62560955 }; #define mem0 GLOBAL(struct Mem0Global, mem0) diff --git a/src/mem3.c b/src/mem3.c index 0379ade8a..1c2c9511c 100644 --- a/src/mem3.c +++ b/src/mem3.c @@ -23,7 +23,7 @@ ** This version of the memory allocation subsystem is included ** in the build only if SQLITE_ENABLE_MEMSYS3 is defined. ** -** $Id: mem3.c,v 1.22 2008/09/02 10:22:01 danielk1977 Exp $ +** $Id: mem3.c,v 1.23 2008/09/02 17:52:52 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -101,6 +101,13 @@ struct Mem3Block { */ static SQLITE_WSD struct Mem3Global { /* + ** Memory available for allocation. nPool is the size of the array + ** (in Mem3Blocks) pointed to by aPool less 2. + */ + u32 nPool; + Mem3Block *aPool; + + /* ** True if we are evaluating an out-of-memory callback. */ int alarmBusy; @@ -131,14 +138,7 @@ static SQLITE_WSD struct Mem3Global { */ u32 aiSmall[MX_SMALL-1]; /* For sizes 2 through MX_SMALL, inclusive */ u32 aiHash[N_HASH]; /* For sizes MX_SMALL+1 and larger */ - - /* - ** Memory available for allocation. nPool is the size of the array - ** (in Mem3Blocks) pointed to by aPool less 2. - */ - u32 nPool; - Mem3Block *aPool; -} mem3 = {}; +} mem3 = { 97535575 }; #define mem3 GLOBAL(struct Mem3Global, mem3) diff --git a/src/mem5.c b/src/mem5.c index 1ce044248..6044bd8ab 100644 --- a/src/mem5.c +++ b/src/mem5.c @@ -23,7 +23,7 @@ ** This version of the memory allocation subsystem is included ** in the build only if SQLITE_ENABLE_MEMSYS5 is defined. ** -** $Id: mem5.c,v 1.13 2008/09/02 10:22:01 danielk1977 Exp $ +** $Id: mem5.c,v 1.14 2008/09/02 17:52:52 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -87,16 +87,11 @@ struct Mem5Link { */ static SQLITE_WSD struct Mem5Global { /* - ** The alarm callback and its arguments. The mem5.mutex lock will - ** be held while the callback is running. Recursive calls into - ** the memory subsystem are allowed, but no new callbacks will be - ** issued. The alarmBusy variable is set to prevent recursive - ** callbacks. + ** Memory available for allocation */ - sqlite3_int64 alarmThreshold; - void (*alarmCallback)(void*, sqlite3_int64,int); - void *alarmArg; - int alarmBusy; + int nAtom; /* Smallest possible allocation in bytes */ + int nBlock; /* Number of nAtom sized blocks in zPool */ + u8 *zPool; /* ** Mutex to control access to the memory allocation subsystem. @@ -126,13 +121,7 @@ static SQLITE_WSD struct Mem5Global { */ u8 *aCtrl; - /* - ** Memory available for allocation - */ - int nAtom; /* Smallest possible allocation in bytes */ - int nBlock; /* Number of nAtom sized blocks in zPool */ - u8 *zPool; -} mem5 = {}; +} mem5 = { 19804167 }; #define mem5 GLOBAL(struct Mem5Global, mem5) diff --git a/src/mem6.c b/src/mem6.c index 168262fba..8a1be5ee7 100644 --- a/src/mem6.c +++ b/src/mem6.c @@ -32,7 +32,7 @@ ** fragmentation. On some systems, heap fragmentation can cause a ** significant real-time slowdown. ** -** $Id: mem6.c,v 1.9 2008/09/02 10:22:01 danielk1977 Exp $ +** $Id: mem6.c,v 1.10 2008/09/02 17:52:52 danielk1977 Exp $ */ #ifdef SQLITE_ENABLE_MEMSYS6 @@ -110,7 +110,7 @@ static SQLITE_WSD struct Mem6Global { int nLogThreshold; /* log2 of (nThreshold/nMinAlloc) */ sqlite3_mutex *mutex; Mem6Chunk *pChunk; /* Singly linked list of all memory chunks */ -} mem6 = {}; +} mem6 = { 48642791 }; #define mem6 GLOBAL(struct Mem6Global, mem6) |