Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Provide an (undocumented) compile-time option to disable the page cache overflow counter, in order to avoid a mutex. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
208825cd830748a2ca456affc57be75b |
User & Date: | drh 2012-06-07 02:35:29 |
Context
2012-06-07
| ||
07:24 | Fix a malloc/free mismatch in pager.c (sqlite3_free() called on a buffer allocated by sqlite3DbMalloc()). (check-in: 506008f0 user: dan tags: trunk) | |
02:35 | Provide an (undocumented) compile-time option to disable the page cache overflow counter, in order to avoid a mutex. (check-in: 208825cd user: drh tags: trunk) | |
2012-06-06
| ||
23:59 | Fix harmless Clang warnings. (check-in: 31fe1985 user: drh tags: trunk) | |
Changes
Changes to src/pcache1.c.
︙ | ︙ | |||
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | sqlite3_mutex_leave(pcache1.mutex); } if( p==0 ){ /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool. Get ** it from sqlite3Malloc instead. */ p = sqlite3Malloc(nByte); if( p ){ int sz = sqlite3MallocSize(p); sqlite3_mutex_enter(pcache1.mutex); sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz); sqlite3_mutex_leave(pcache1.mutex); } sqlite3MemdebugSetType(p, MEMTYPE_PCACHE); } return p; } /* ** Free an allocated buffer obtained from pcache1Alloc(). | > > | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | sqlite3_mutex_leave(pcache1.mutex); } if( p==0 ){ /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool. Get ** it from sqlite3Malloc instead. */ p = sqlite3Malloc(nByte); #ifndef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS if( p ){ int sz = sqlite3MallocSize(p); sqlite3_mutex_enter(pcache1.mutex); sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz); sqlite3_mutex_leave(pcache1.mutex); } #endif sqlite3MemdebugSetType(p, MEMTYPE_PCACHE); } return p; } /* ** Free an allocated buffer obtained from pcache1Alloc(). |
︙ | ︙ | |||
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | pcache1.bUnderPressure = pcache1.nFreeSlot<pcache1.nReserve; assert( pcache1.nFreeSlot<=pcache1.nSlot ); sqlite3_mutex_leave(pcache1.mutex); }else{ assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) ); sqlite3MemdebugSetType(p, MEMTYPE_HEAP); nFreed = sqlite3MallocSize(p); sqlite3_mutex_enter(pcache1.mutex); sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, -nFreed); sqlite3_mutex_leave(pcache1.mutex); sqlite3_free(p); } return nFreed; } #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT /* | > > | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | pcache1.bUnderPressure = pcache1.nFreeSlot<pcache1.nReserve; assert( pcache1.nFreeSlot<=pcache1.nSlot ); sqlite3_mutex_leave(pcache1.mutex); }else{ assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) ); sqlite3MemdebugSetType(p, MEMTYPE_HEAP); nFreed = sqlite3MallocSize(p); #ifndef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS sqlite3_mutex_enter(pcache1.mutex); sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, -nFreed); sqlite3_mutex_leave(pcache1.mutex); #endif sqlite3_free(p); } return nFreed; } #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT /* |
︙ | ︙ |