From: dan Date: Fri, 25 Jun 2010 16:34:32 +0000 (+0000) Subject: Reduce the average (but not maximum) size of the allocations made as part of a checkp... X-Git-Tag: version-3.7.2~229 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=52d6fc0eda511b1156be9b486322fdba627cd2eb;p=thirdparty%2Fsqlite.git Reduce the average (but not maximum) size of the allocations made as part of a checkpoint. FossilOrigin-Name: 4a7fd91b7ab2c5d21fbac7f6f123820c8f4ec7f6 --- diff --git a/manifest b/manifest index 9a8531a0cd..ced8a2cef1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reduce\sthe\ssize\sof\sthe\slarge\sallocation\s(approx\s8KB\sfor\severy\s4000\sframes\sin\sthe\slog)\sthat\soccurs\sduring\scheckpoint.\sUse\sthe\s'scratch'\smemory\sfor\sthis\sallocation\sinstead\sof\sthe\sgeneral\spurpose\sallocation. -D 2010-06-25T15:16:25 +C Reduce\sthe\saverage\s(but\snot\smaximum)\ssize\sof\sthe\sallocations\smade\sas\spart\sof\sa\scheckpoint. +D 2010-06-25T16:34:32 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -226,7 +226,7 @@ F src/vdbeblob.c 258a6010ba7a82b72b327fb24c55790655689256 F src/vdbemem.c 5e579abf6532001dfbee0e640dc34eae897a9807 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda -F src/wal.c 7f2c67f14fd3f84fb725cbfdf4df894eeee80a6d +F src/wal.c 22522709a4eb911fa9d595f033cfa5db63e16981 F src/wal.h 4ace25262452d17e7d3ec970c89ee17794004008 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/where.c 1c895bef33d0dfc7ed90fb1f74120435d210ea56 @@ -825,7 +825,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P af471ed79f539ff495f6d4cb3b69188c8af7ae3d -R 3f79fa337bc0c5c5671e54a144204fa5 +P 29887487ed549f97c3c9b37f852bae179b6ea9a9 +R 0d354ce5ca0d0be1f06510bbeac66ab5 U dan -Z 49c1806c3eb5e28123879bb170870e95 +Z 4ef8c49b4f2e94b4894a55fae3b39c83 diff --git a/manifest.uuid b/manifest.uuid index 8c14e61b74..10328ee61f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -29887487ed549f97c3c9b37f852bae179b6ea9a9 \ No newline at end of file +4a7fd91b7ab2c5d21fbac7f6f123820c8f4ec7f6 \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index 62ed887f30..69b213dd20 100644 --- a/src/wal.c +++ b/src/wal.c @@ -1425,8 +1425,8 @@ static int walIteratorInit(Wal *pWal, WalIterator **pp){ /* Allocate space for the WalIterator object. */ nSegment = walFramePage(iLast) + 1; nByte = sizeof(WalIterator) - + (nSegment-1)*(sizeof(struct WalSegment)) - + nSegment*(HASHTABLE_NPAGE * sizeof(ht_slot)); + + (nSegment-1)*sizeof(struct WalSegment) + + iLast*sizeof(ht_slot); p = (WalIterator *)sqlite3ScratchMalloc(nByte); if( !p ){ return SQLITE_NOMEM; @@ -1437,26 +1437,29 @@ static int walIteratorInit(Wal *pWal, WalIterator **pp){ /* Allocate temporary space used by the merge-sort routine. This block ** of memory will be freed before this function returns. */ - aTmp = (ht_slot *)sqlite3ScratchMalloc(HASHTABLE_NPAGE * sizeof(ht_slot)); + aTmp = (ht_slot *)sqlite3ScratchMalloc( + sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast) + ); if( !aTmp ){ rc = SQLITE_NOMEM; } for(i=0; rc==SQLITE_OK && iaSegment[p->nSegment])[iZero]; iZero++; - aIndex = &((ht_slot *)&p->aSegment[p->nSegment])[i*HASHTABLE_NPAGE]; for(j=0; j