Add the new memory allocator to the amalgamation. Improvements to
out-of-memory handling. (CVS 4498) FossilOrigin-Name: b58c2b37a5deb19ce0ef78629989016743a46bb3
This commit is contained in:
parent
c0ad3e8df6
commit
979aeaa395
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Bug\sfix\sin\sthe\srealloc\salgorithm\sof\sthe\sstatic\smemory\sallocator.\s(CVS\s4497)
|
||||
D 2007-10-20T16:11:39
|
||||
C Add\sthe\snew\smemory\sallocator\sto\sthe\samalgamation.\s\sImprovements\sto\nout-of-memory\shandling.\s(CVS\s4498)
|
||||
D 2007-10-20T16:36:31
|
||||
F Makefile.in 30c7e3ba426ddb253b8ef037d1873425da6009a8
|
||||
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -100,11 +100,11 @@ F src/legacy.c 4ac53191fad2e3c4d59bde1228879b2dc5a96d66
|
||||
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
|
||||
F src/loadext.c 124e566563d1c03e68e1396cb44df9870612c6e9
|
||||
F src/main.c 994a6b6914d91dc6dea5012667ec0a52e74d3bca
|
||||
F src/malloc.c de4e77fe70a9a0ac47a1c3a874422b107231bf31
|
||||
F src/malloc.c 60e392a4c12c839517f9b0db7b995f825444fb35
|
||||
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
|
||||
F src/mem1.c cacb202bc379da10d69aa66d497c0ea7bd9cd8a5
|
||||
F src/mem2.c 3f669b5e20975a5a2ca392aca891cd686e22b097
|
||||
F src/mem3.c 232f658b5919a979e894817e8d9a8047cc01738a
|
||||
F src/mem3.c df13c608e8dfb54f62e3448eb126e760aecbacf1
|
||||
F src/mutex.c 3259f62c2429967aee6dc112117a6d2f499ef061
|
||||
F src/mutex.h 079fa6fe9da18ceb89e79012c010594c6672addb
|
||||
F src/mutex_os2.c 7fe4773e98ed74a63b2e54fc557929eb155f6269
|
||||
@ -512,7 +512,7 @@ F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
|
||||
F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
|
||||
F tool/mkkeywordhash.c ef93810fc41fb3d3dbacf9a33a29be88ea99ffa9
|
||||
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
|
||||
F tool/mksqlite3c.tcl 1b2fc352849823600fea9474245591e96733e557
|
||||
F tool/mksqlite3c.tcl 48778943a2fc83a4fdcbb3e109706b4b8e1b135a
|
||||
F tool/mksqlite3internalh.tcl 47737a925fb02fce43e2c0a14b3cc17574a4d44a
|
||||
F tool/omittest.tcl 7d1fdf469e2f4d175f70c36e469db64a1626fabb
|
||||
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
|
||||
@ -582,7 +582,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P ca51b2f54076fcf73a8857aecf4b45d66ef0c7b6
|
||||
R 149041cc2a0cdac1aeaffd2ccb597c27
|
||||
P 50db16be5025f6d5efc51e3354615059da7e8611
|
||||
R 9881665fdb8e4b9770ed547fbe8fa687
|
||||
U drh
|
||||
Z c7cecaa706d7ed7726d405d4a3f2983e
|
||||
Z fb42a97e45f6a24233932545382ee686
|
||||
|
@ -1 +1 @@
|
||||
50db16be5025f6d5efc51e3354615059da7e8611
|
||||
b58c2b37a5deb19ce0ef78629989016743a46bb3
|
@ -12,7 +12,7 @@
|
||||
** Memory allocation functions used throughout sqlite.
|
||||
**
|
||||
**
|
||||
** $Id: malloc.c,v 1.13 2007/08/29 14:06:23 danielk1977 Exp $
|
||||
** $Id: malloc.c,v 1.14 2007/10/20 16:36:31 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <stdarg.h>
|
||||
@ -237,4 +237,3 @@ int sqlite3ApiExit(sqlite3* db, int rc){
|
||||
}
|
||||
return rc & (db ? db->errMask : 0xff);
|
||||
}
|
||||
|
||||
|
37
src/mem3.c
37
src/mem3.c
@ -20,7 +20,7 @@
|
||||
** This version of the memory allocation subsystem is used if
|
||||
** and only if SQLITE_MEMORY_SIZE is defined.
|
||||
**
|
||||
** $Id: mem3.c,v 1.4 2007/10/20 16:11:39 drh Exp $
|
||||
** $Id: mem3.c,v 1.5 2007/10/20 16:36:31 drh Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -372,6 +372,7 @@ static void memsys3Merge(int *pRoot){
|
||||
static void *memsys3Malloc(int nByte){
|
||||
int i;
|
||||
int nBlock;
|
||||
int toFree;
|
||||
|
||||
assert( sizeof(Mem3Block)==8 );
|
||||
if( nByte<=0 ){
|
||||
@ -418,22 +419,24 @@ static void *memsys3Malloc(int nByte){
|
||||
** of the end of the master chunk. This step happens very
|
||||
** rarely (we hope!)
|
||||
*/
|
||||
memsys3OutOfMemory(nBlock*16);
|
||||
if( mem.iMaster ){
|
||||
memsys3Link(mem.iMaster);
|
||||
mem.iMaster = 0;
|
||||
mem.szMaster = 0;
|
||||
}
|
||||
for(i=0; i<N_HASH; i++){
|
||||
memsys3Merge(&mem.aiHash[i]);
|
||||
}
|
||||
for(i=0; i<MX_SMALL-1; i++){
|
||||
memsys3Merge(&mem.aiSmall[i]);
|
||||
}
|
||||
if( mem.szMaster ){
|
||||
memsys3Unlink(mem.iMaster);
|
||||
if( mem.szMaster>=nBlock ){
|
||||
return memsys3FromMaster(nBlock);
|
||||
for(toFree=nBlock*16; toFree<SQLITE_MEMORY_SIZE*2; toFree *= 2){
|
||||
memsys3OutOfMemory(toFree);
|
||||
if( mem.iMaster ){
|
||||
memsys3Link(mem.iMaster);
|
||||
mem.iMaster = 0;
|
||||
mem.szMaster = 0;
|
||||
}
|
||||
for(i=0; i<N_HASH; i++){
|
||||
memsys3Merge(&mem.aiHash[i]);
|
||||
}
|
||||
for(i=0; i<MX_SMALL-1; i++){
|
||||
memsys3Merge(&mem.aiSmall[i]);
|
||||
}
|
||||
if( mem.szMaster ){
|
||||
memsys3Unlink(mem.iMaster);
|
||||
if( mem.szMaster>=nBlock ){
|
||||
return memsys3FromMaster(nBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,6 +202,7 @@ foreach file {
|
||||
|
||||
mem1.c
|
||||
mem2.c
|
||||
mem3.c
|
||||
mutex.c
|
||||
mutex_os2.c
|
||||
mutex_unix.c
|
||||
|
Loading…
x
Reference in New Issue
Block a user