-C Add\sthe\soptimization\sto\savoid\ssome\sunnecessary\scalls\sto\ssqlite3VdbeRecordUnpack()\sadded\sto\sthe\strunk\sby\s[707ea170b3].
-D 2014-03-29T06:27:35.162
+C Fix\sa\sproblem\sin\svdbesort.c\scausing\sspurious\sSQLITE_NOMEM\serrors\swhen\susing\smemsys3\sor\smemsys5.
+D 2014-03-29T09:34:45.457
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ad0921c4b2780d01868cf69b419a4f102308d125
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/vdbeaux.c 1153175fb57a8454e1c8cf79b59b7bf92b26779d
F src/vdbeblob.c 15377abfb59251bccedd5a9c7d014a895f0c04aa
F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447
-F src/vdbesort.c d7ef3c431d7996907815a13579952506bf2bdf8b
+F src/vdbesort.c 80812ceb596febe778d506587d24bef6fabc00d4
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd
F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 4c7fb5423430f3b936befaa7c309f8e1968ee7d8
-R c555f8c440b397229a1b1d80867cea18
+P fc4d04e6b039ea5aeb47739e38c5926e63a4b01b
+R 58d9f269ef794b7845b0943176283ea0
U dan
-Z 5b7820939497d4f0728d4d29380b4189
+Z 849635fb9198ef253e10fe8fcdddee0e
){
int rc;
int iPrev = pMerger->aTree[1];/* Index of iterator to advance */
- int i; /* Index of aTree[] to recalculate */
/* Advance the current iterator */
rc = vdbeSorterIterNext(&pMerger->aIter[iPrev]);
if( bUseFg==0 ){
/* Launch a background thread for this operation */
void *pCtx = (void*)pThread;
- if( pSorter->aMemory==0 ){
- pSorter->aMemory = sqlite3Malloc(pSorter->nMemory);
- if( pSorter->aMemory==0 ) return SQLITE_NOMEM;
- }else{
- pSorter->nMemory = sqlite3MallocSize(pSorter->aMemory);
+ assert( pSorter->aMemory==0 || pThread->aListMemory==0 );
+ if( pThread->aListMemory ){
+ if( pSorter->aMemory==0 ){
+ pSorter->aMemory = sqlite3Malloc(pSorter->nMemory);
+ if( pSorter->aMemory==0 ) return SQLITE_NOMEM;
+ }else{
+ pSorter->nMemory = sqlite3MallocSize(pSorter->aMemory);
+ }
}
rc = sqlite3ThreadCreate(&pThread->pThread, vdbeSorterThreadMain, pCtx);
}else{
*/
nReq = pVal->n + sizeof(SorterRecord);
nPMA = pVal->n + sqlite3VarintLen(pVal->n);
- if( pSorter->aMemory ){
- bFlush = pSorter->iMemory && (pSorter->iMemory+nReq) > pSorter->mxPmaSize;
- }else{
- bFlush = (
- (pSorter->nInMemory > pSorter->mxPmaSize)
- || (pSorter->nInMemory > pSorter->mnPmaSize && sqlite3HeapNearlyFull())
- );
- }
- if( bFlush ){
- rc = vdbeSorterFlushPMA(db, pCsr, 0);
- pSorter->nInMemory = 0;
- pSorter->iMemory = 0;
- assert( rc!=SQLITE_OK || pSorter->pRecord==0 );
+ if( pSorter->mxPmaSize ){
+ if( pSorter->aMemory ){
+ bFlush = pSorter->iMemory && (pSorter->iMemory+nReq) > pSorter->mxPmaSize;
+ }else{
+ bFlush = (
+ (pSorter->nInMemory > pSorter->mxPmaSize)
+ || (pSorter->nInMemory > pSorter->mnPmaSize && sqlite3HeapNearlyFull())
+ );
+ }
+ if( bFlush ){
+ rc = vdbeSorterFlushPMA(db, pCsr, 0);
+ pSorter->nInMemory = 0;
+ pSorter->iMemory = 0;
+ assert( rc!=SQLITE_OK || pSorter->pRecord==0 );
+ }
}
pSorter->nInMemory += nPMA;
pSorter->iMemory += ROUND8(nReq);
pNew->u.iNext = (u8*)(pSorter->pRecord) - pSorter->aMemory;
}else{
- pNew = (SorterRecord *)sqlite3Malloc(pVal->n+sizeof(SorterRecord));
+ pNew = (SorterRecord *)sqlite3Malloc(nReq);
if( pNew==0 ){
return SQLITE_NOMEM;
}