-C Fix\sfor\smemory\sleak\sin\smalloc3.test.\s(CVS\s4913)
-D 2008-03-25T09:56:45
+C Have\seach\s{quote:\sBtShared}\sstructure\shang\son\sto\sa\sbuffer\sof\sjust\sunder\spage-size\sbytes\sfor\stemporary\suse.\sThis\sreduces\sthe\snumber\sof\scalls\sto\smalloc().\s(CVS\s4914)
+D 2008-03-25T14:24:57
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in cf434ce8ca902e69126ae0f94fc9f7dc7428a5fa
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 49817d442e51e4123585f3cf3c2afc293a3c91e2
F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2
-F src/btree.c 0a170b7bb69035f6e5c4d722e907b908c5480e83
+F src/btree.c 366f5f66ebb3dfdc8513242d4aecbfb402dcc0a9
F src/btree.h e02869e1e7753ad5b3c7cb7852e952c95c2e609a
-F src/btreeInt.h c2deca3e778e2a1e6196343b8087a868f4faa19a
+F src/btreeInt.h d232be68a7ab2a24376dc6332a869e717551b0bd
F src/build.c d0715b3454b140cb405412e3029ec7c0fb434efd
F src/callback.c 77b302b0d41468dcda78c70e706e5b84577f0fa0
F src/complete.c 4cf68fd75d60257524cbe74f87351b9848399131
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 047153648155654b0cd70b811935209d2e21776c
-R fe7778c82934f6b01597127050469d93
+P ef0e40e814b3d3a00721f8ca39bac0db1be24347
+R d58ce8f374758d218509d77eae1fa411
U danielk1977
-Z cbb9339bf69751e7040fab28fe7c6c53
+Z 6b876eb9851a975cdfed8252be002c4a
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.445 2008/03/25 09:56:45 danielk1977 Exp $
+** $Id: btree.c,v 1.446 2008/03/25 14:24:57 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
pBt->xFreeSchema(pBt->pSchema);
}
sqlite3_free(pBt->pSchema);
+ sqlite3_free(pBt->pTmpSpace);
sqlite3_free(pBt);
}
assert( (pageSize & 7)==0 );
assert( !pBt->pPage1 && !pBt->pCursor );
pBt->pageSize = pageSize;
+ sqlite3_free(pBt->pTmpSpace);
+ pBt->pTmpSpace = 0;
rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize);
}
pBt->usableSize = pBt->pageSize - nReserve;
releasePage(pPage1);
pBt->usableSize = usableSize;
pBt->pageSize = pageSize;
+ sqlite3_free(pBt->pTmpSpace);
+ pBt->pTmpSpace = 0;
sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize);
return SQLITE_OK;
}
return SQLITE_OK;
}
+/*
+** Make sure pBt->pTmpSpace points to an allocation of
+** MX_CELL_SIZE(pBt) bytes.
+*/
+static void allocateTempSpace(BtShared *pBt){
+ if( !pBt->pTmpSpace ){
+ pBt->pTmpSpace = sqlite3_malloc(MX_CELL_SIZE(pBt));
+ }
+}
+
/*
** Insert a new record into the BTree. The key is given by (pKey,nKey)
** and the data is given by (pData,nData). The cursor is used only to
pCur->pgnoRoot, nKey, nData, pPage->pgno,
loc==0 ? "overwrite" : "new entry"));
assert( pPage->isInit );
- newCell = sqlite3_malloc( MX_CELL_SIZE(pBt) );
+ allocateTempSpace(pBt);
+ newCell = pBt->pTmpSpace;
if( newCell==0 ) return SQLITE_NOMEM;
rc = fillInCell(pPage, newCell, pKey, nKey, pData, nData, nZero, &szNew);
if( rc ) goto end_insert;
moveToRoot(pCur);
}
end_insert:
- sqlite3_free(newCell);
return rc;
}
pNext = findCell(leafCur.pPage, leafCur.idx);
szNext = cellSizePtr(leafCur.pPage, pNext);
assert( MX_CELL_SIZE(pBt)>=szNext+4 );
- tempCell = sqlite3_malloc( MX_CELL_SIZE(pBt) );
+ allocateTempSpace(pBt);
+ tempCell = pBt->pTmpSpace;
if( tempCell==0 ){
rc = SQLITE_NOMEM;
}
rc = balance(leafCur.pPage, 0);
}
}
- sqlite3_free(tempCell);
sqlite3BtreeReleaseTempCursor(&leafCur);
}else{
TRACE(("DELETE: table=%d delete from leaf %d\n",
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btreeInt.h,v 1.18 2008/03/25 00:22:21 drh Exp $
+** $Id: btreeInt.h,v 1.19 2008/03/25 14:24:57 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
BtLock *pLock; /* List of locks held on this shared-btree struct */
Btree *pExclusive; /* Btree with an EXCLUSIVE lock on the whole db */
#endif
+ u8 *pTmpSpace; /* BtShared.pageSize bytes of space for tmp use */
};
/*