Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix two asserts on the scratch allocator to allow for up to two outstanding scratch allocations per thread. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f149b498b6ada3fc9f71ee104c351554 |
User & Date: | drh 2010-06-26 20:25:31.000 |
Context
2010-06-26
| ||
21:34 | Suppress various compiler warnings. (check-in: e82d008eaf user: drh tags: trunk) | |
20:25 | Fix two asserts on the scratch allocator to allow for up to two outstanding scratch allocations per thread. (check-in: f149b498b6 user: drh tags: trunk) | |
20:00 | Suppress a couple uninitialized variable warnings. (check-in: 29571e228c user: drh tags: trunk) | |
Changes
Changes to src/malloc.c.
︙ | ︙ | |||
311 312 313 314 315 316 317 | ** embedded processor. */ void *sqlite3ScratchMalloc(int n){ void *p; assert( n>0 ); #if SQLITE_THREADSAFE==0 && !defined(NDEBUG) | | | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | ** embedded processor. */ void *sqlite3ScratchMalloc(int n){ void *p; assert( n>0 ); #if SQLITE_THREADSAFE==0 && !defined(NDEBUG) /* Verify that no more than two scratch allocation per thread ** is outstanding at one time. (This is only checked in the ** single-threaded case since checking in the multi-threaded case ** would be much more complicated.) */ assert( scratchAllocOut<=1 ); #endif if( sqlite3GlobalConfig.szScratch<n ){ goto scratch_overflow; }else{ sqlite3_mutex_enter(mem0.mutex); if( mem0.nScratchFree==0 ){ |
︙ | ︙ | |||
360 361 362 363 364 365 366 | #if SQLITE_THREADSAFE==0 && !defined(NDEBUG) scratchAllocOut = p!=0; #endif return p; } void sqlite3ScratchFree(void *p){ if( p ){ | < < < < < < < < < < | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | #if SQLITE_THREADSAFE==0 && !defined(NDEBUG) scratchAllocOut = p!=0; #endif return p; } void sqlite3ScratchFree(void *p){ if( p ){ if( sqlite3GlobalConfig.pScratch==0 || p<sqlite3GlobalConfig.pScratch || p>=(void*)mem0.aScratchFree ){ assert( sqlite3MemdebugHasType(p, MEMTYPE_SCRATCH) ); sqlite3MemdebugSetType(p, MEMTYPE_HEAP); if( sqlite3GlobalConfig.bMemstat ){ int iSize = sqlite3MallocSize(p); |
︙ | ︙ | |||
395 396 397 398 399 400 401 402 403 404 405 406 407 408 | i /= sqlite3GlobalConfig.szScratch; assert( i>=0 && i<sqlite3GlobalConfig.nScratch ); sqlite3_mutex_enter(mem0.mutex); assert( mem0.nScratchFree<(u32)sqlite3GlobalConfig.nScratch ); mem0.aScratchFree[mem0.nScratchFree++] = i; sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, -1); sqlite3_mutex_leave(mem0.mutex); } } } /* ** TRUE if p is a lookaside memory allocation from db */ | > > > > > > > > > > | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | i /= sqlite3GlobalConfig.szScratch; assert( i>=0 && i<sqlite3GlobalConfig.nScratch ); sqlite3_mutex_enter(mem0.mutex); assert( mem0.nScratchFree<(u32)sqlite3GlobalConfig.nScratch ); mem0.aScratchFree[mem0.nScratchFree++] = i; sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, -1); sqlite3_mutex_leave(mem0.mutex); #if SQLITE_THREADSAFE==0 && !defined(NDEBUG) /* Verify that no more than two scratch allocation per thread ** is outstanding at one time. (This is only checked in the ** single-threaded case since checking in the multi-threaded case ** would be much more complicated.) */ assert( scratchAllocOut>=1 && scratchAllocOut<=2 ); scratchAllocOut = 0; #endif } } } /* ** TRUE if p is a lookaside memory allocation from db */ |
︙ | ︙ |