Lines Matching refs:mem0
14127 /************** Begin file mem0.c ********************************************/
14187 /************** End of mem0.c ************************************************/
17511 ** The alarm callback and its arguments. The mem0.mutex lock will
17535 } mem0 = { 0, 0, 0, 0, 0, 0, 0, 0 };
17537 #define mem0 GLOBAL(struct Mem0Global, mem0)
17562 sqlite3_mutex_enter(mem0.mutex);
17563 mem0.alarmCallback = xCallback;
17564 mem0.alarmArg = pArg;
17565 mem0.alarmThreshold = iThreshold;
17567 mem0.nearlyFull = (iThreshold>0 && iThreshold<=nUsed);
17568 sqlite3_mutex_leave(mem0.mutex);
17596 sqlite3_mutex_enter(mem0.mutex);
17597 priorLimit = mem0.alarmThreshold;
17598 sqlite3_mutex_leave(mem0.mutex);
17621 memset(&mem0, 0, sizeof(mem0));
17623 mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
17633 mem0.pScratchFree = pSlot;
17634 mem0.nScratchFree = n;
17640 mem0.pScratchEnd = (void*)&pSlot[1];
17642 mem0.pScratchEnd = 0;
17662 return mem0.nearlyFull;
17672 memset(&mem0, 0, sizeof(mem0));
17706 if( mem0.alarmCallback==0 ) return;
17707 xCallback = mem0.alarmCallback;
17709 pArg = mem0.alarmArg;
17710 mem0.alarmCallback = 0;
17711 sqlite3_mutex_leave(mem0.mutex);
17713 sqlite3_mutex_enter(mem0.mutex);
17714 mem0.alarmCallback = xCallback;
17715 mem0.alarmArg = pArg;
17725 assert( sqlite3_mutex_held(mem0.mutex) );
17728 if( mem0.alarmCallback!=0 ){
17730 if( nUsed+nFull >= mem0.alarmThreshold ){
17731 mem0.nearlyFull = 1;
17734 mem0.nearlyFull = 0;
17739 if( p==0 && mem0.alarmCallback ){
17769 sqlite3_mutex_enter(mem0.mutex);
17771 sqlite3_mutex_leave(mem0.mutex);
17814 sqlite3_mutex_enter(mem0.mutex);
17815 if( mem0.nScratchFree && sqlite3GlobalConfig.szScratch>=n ){
17816 p = mem0.pScratchFree;
17817 mem0.pScratchFree = mem0.pScratchFree->pNext;
17818 mem0.nScratchFree--;
17821 sqlite3_mutex_leave(mem0.mutex);
17827 sqlite3_mutex_leave(mem0.mutex);
17829 sqlite3_mutex_leave(mem0.mutex);
17834 assert( sqlite3_mutex_notheld(mem0.mutex) );
17860 if( p>=sqlite3GlobalConfig.pScratch && p<mem0.pScratchEnd ){
17864 sqlite3_mutex_enter(mem0.mutex);
17865 pSlot->pNext = mem0.pScratchFree;
17866 mem0.pScratchFree = pSlot;
17867 mem0.nScratchFree++;
17868 assert( mem0.nScratchFree<=sqlite3GlobalConfig.nScratch );
17870 sqlite3_mutex_leave(mem0.mutex);
17878 sqlite3_mutex_enter(mem0.mutex);
17883 sqlite3_mutex_leave(mem0.mutex);
17931 sqlite3_mutex_enter(mem0.mutex);
17935 sqlite3_mutex_leave(mem0.mutex);
17992 sqlite3_mutex_enter(mem0.mutex);
17995 mem0.alarmThreshold ){
18001 if( pNew==0 && mem0.alarmCallback ){
18009 sqlite3_mutex_leave(mem0.mutex);