Lines Matching refs:mem0
55 } mem0 = { 0, SQLITE_MAX_MEMORY, SQLITE_MAX_MEMORY, 0 }; variable
57 #define mem0 GLOBAL(struct Mem0Global, mem0) macro
63 return mem0.mutex; in sqlite3MallocMutex()
103 sqlite3_mutex_enter(mem0.mutex); in sqlite3_soft_heap_limit64()
104 priorLimit = mem0.alarmThreshold; in sqlite3_soft_heap_limit64()
106 sqlite3_mutex_leave(mem0.mutex); in sqlite3_soft_heap_limit64()
109 if( mem0.hardLimit>0 && (n>mem0.hardLimit || n==0) ){ in sqlite3_soft_heap_limit64()
110 n = mem0.hardLimit; in sqlite3_soft_heap_limit64()
112 mem0.alarmThreshold = n; in sqlite3_soft_heap_limit64()
114 AtomicStore(&mem0.nearlyFull, n>0 && n<=nUsed); in sqlite3_soft_heap_limit64()
115 sqlite3_mutex_leave(mem0.mutex); in sqlite3_soft_heap_limit64()
143 sqlite3_mutex_enter(mem0.mutex); in sqlite3_hard_heap_limit64()
144 priorLimit = mem0.hardLimit; in sqlite3_hard_heap_limit64()
146 mem0.hardLimit = n; in sqlite3_hard_heap_limit64()
147 if( n<mem0.alarmThreshold || mem0.alarmThreshold==0 ){ in sqlite3_hard_heap_limit64()
148 mem0.alarmThreshold = n; in sqlite3_hard_heap_limit64()
151 sqlite3_mutex_leave(mem0.mutex); in sqlite3_hard_heap_limit64()
164 mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); in sqlite3MallocInit()
171 if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0)); in sqlite3MallocInit()
181 return AtomicLoad(&mem0.nearlyFull); in sqlite3HeapNearlyFull()
191 memset(&mem0, 0, sizeof(mem0)); in sqlite3MallocEnd()
218 if( mem0.alarmThreshold<=0 ) return; in sqlite3MallocAlarm()
219 sqlite3_mutex_leave(mem0.mutex); in sqlite3MallocAlarm()
221 sqlite3_mutex_enter(mem0.mutex); in sqlite3MallocAlarm()
231 assert( sqlite3_mutex_held(mem0.mutex) ); in mallocWithAlarm()
242 if( mem0.alarmThreshold>0 ){ in mallocWithAlarm()
244 if( nUsed >= mem0.alarmThreshold - nFull ){ in mallocWithAlarm()
245 AtomicStore(&mem0.nearlyFull, 1); in mallocWithAlarm()
247 if( mem0.hardLimit ){ in mallocWithAlarm()
249 if( nUsed >= mem0.hardLimit - nFull ){ in mallocWithAlarm()
255 AtomicStore(&mem0.nearlyFull, 0); in mallocWithAlarm()
260 if( p==0 && mem0.alarmThreshold>0 ){ in mallocWithAlarm()
303 sqlite3_mutex_enter(mem0.mutex); in sqlite3Malloc()
305 sqlite3_mutex_leave(mem0.mutex); in sqlite3Malloc()
398 sqlite3_mutex_enter(mem0.mutex); in sqlite3_free()
402 sqlite3_mutex_leave(mem0.mutex); in sqlite3_free()
530 sqlite3_mutex_enter(mem0.mutex); in sqlite3Realloc()
534 mem0.alarmThreshold-nDiff ){ in sqlite3Realloc()
536 if( mem0.hardLimit>0 && nUsed >= mem0.hardLimit - nDiff ){ in sqlite3Realloc()
537 sqlite3_mutex_leave(mem0.mutex); in sqlite3Realloc()
543 if( pNew==0 && mem0.alarmThreshold>0 ){ in sqlite3Realloc()
552 sqlite3_mutex_leave(mem0.mutex); in sqlite3Realloc()