-C If\sthe\sapplication-defined\sopenDirectory()\sfunction\sreturns\sSQLITE_CANTOPEN,\nthen\ssilently\signore\sthe\serror.\s\sThis\sallows\sthe\schromium\ssandbox\sto\sdisallow\nopening\sof\sdirectories\swithout\scausing\serrors.
-D 2011-08-23T20:11:32.027
+C Simplifications\sto\sthe\sSQLITE_PAGECACHE_BLOCKALLOC\slogic.\s\sReduce\sthe\snumber\nof\sdifficult-to-reach\sbranches.
+D 2011-08-23T23:41:40.811
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 8c930e7b493d59099ea1304bd0f2aed152eb3315
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
F src/pcache.c 49e718c095810c6b3334e3a6d89970aceaddefce
F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
-F src/pcache1.c a1d860753eee0a46165afaad3962a88463fb32a8
+F src/pcache1.c c8982f7048a70b7fd37975a8f6c84d6bc294175a
F src/pragma.c ebcd20f1e654f5cb3aeef864ed69c4697719fbaa
F src/prepare.c e64261559a3187698a3e7e6c8b001a4f4f98dab4
F src/printf.c 585a36b6a963df832cfb69505afa3a34ed5ef8a1
F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262
-P 40dd8a60be0ca79e0d0bf3a2b5a43f13c02b4971
-R 5e02443774dfa828b5ad397a58754916
+P 880b51150aaed804005f5062b4dd2fa0ffafa147
+R 690091bd4eec428f02b835dd5a4096b1
U drh
-Z d188cae288df33cd4e6f9c6da0cbb238
+Z a67c28a746ea7a9568474b8f0d071914
int mxPinned; /* nMaxpage + 10 - nMinPage */
int nCurrentPage; /* Number of purgeable pages allocated */
PgHdr1 *pLruHead, *pLruTail; /* LRU list of unpinned pages */
+#ifdef SQLITE_PAGECACHE_BLOCKALLOC
+ int isBusy; /* Do not run ReleaseMemory() if true */
PGroupBlockList *pBlockList; /* List of block-lists for this group */
+#endif
};
/*
nByte += sizeof(PGroupBlockList *);
nByte = ROUND8(nByte);
- do{
- for(pList=pGroup->pBlockList; pList; pList=pList->pNext){
- if( pList->nByte==nByte ) break;
+ for(pList=pGroup->pBlockList; pList; pList=pList->pNext){
+ if( pList->nByte==nByte ) break;
+ }
+ if( pList==0 ){
+ PGroupBlockList *pNew;
+ assert( pGroup->isBusy==0 );
+ assert( sqlite3_mutex_held(pGroup->mutex) );
+ pGroup->isBusy = 1; /* Disable sqlite3PcacheReleaseMemory() */
+ pNew = (PGroupBlockList *)sqlite3MallocZero(sizeof(PGroupBlockList));
+ pGroup->isBusy = 0; /* Reenable sqlite3PcacheReleaseMemory() */
+ if( pNew==0 ){
+ /* malloc() failure. Return early. */
+ return 0;
}
- if( pList==0 ){
- PGroupBlockList *pNew;
- pcache1LeaveMutex(pCache->pGroup);
- pNew = (PGroupBlockList *)sqlite3MallocZero(sizeof(PGroupBlockList));
- pcache1EnterMutex(pCache->pGroup);
- if( pNew==0 ){
- /* malloc() failure. Return early. */
- return 0;
- }
- for(pList=pGroup->pBlockList; pList; pList=pList->pNext){
- if( pList->nByte==nByte ) break;
- }
- if( pList ){
- sqlite3_free(pNew);
- }else{
- pNew->nByte = nByte;
- pNew->pNext = pGroup->pBlockList;
- pGroup->pBlockList = pNew;
- pList = pNew;
- }
+#ifdef SQLITE_DEBUG
+ for(pList=pGroup->pBlockList; pList; pList=pList->pNext){
+ assert( pList->nByte!=nByte );
}
- }while( pList==0 );
+#endif
+ pNew->nByte = nByte;
+ pNew->pNext = pGroup->pBlockList;
+ pGroup->pBlockList = pNew;
+ pList = pNew;
+ }
pBlock = pList->pFirst;
if( pBlock==0 || pBlock->mUsed==(((Bitmask)1<<pBlock->nEntry)-1) ){
** structure and MINENTRY allocations of nByte bytes each. If the
** allocator returns more memory than requested, then more than MINENTRY
** allocations may fit in it. */
+ assert( sqlite3_mutex_held(pGroup->mutex) );
pcache1LeaveMutex(pCache->pGroup);
sz = sizeof(PGroupBlock) + PAGECACHE_BLOCKALLOC_MINENTRY * nByte;
pBlock = (PGroupBlock *)sqlite3Malloc(sz);
pList->pLast->pNext = pBlock;
pList->pLast = pBlock;
}
+ p = PAGE_TO_PGHDR1(pCache, pPg);
+ if( pCache->bPurgeable ){
+ pCache->pGroup->nCurrentPage++;
+ }
#else
/* The group mutex must be released before pcache1Alloc() is called. This
** is because it may call sqlite3_release_memory(), which assumes that
pcache1LeaveMutex(pCache->pGroup);
pPg = pcache1Alloc(nByte);
pcache1EnterMutex(pCache->pGroup);
-#endif
-
if( pPg ){
p = PAGE_TO_PGHDR1(pCache, pPg);
if( pCache->bPurgeable ){
}else{
p = 0;
}
+#endif
return p;
}
*/
int sqlite3PcacheReleaseMemory(int nReq){
int nFree = 0;
+#ifdef SQLITE_PAGECACHE_BLOCKALLOC
+ if( pcache1.grp.isBusy ) return 0;
+#endif
assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );
assert( sqlite3_mutex_notheld(pcache1.mutex) );
if( pcache1.pStart==0 ){