private static void pcache1Free(ref PgHdr p) { if (p == null) { return; } if (p.CacheAllocated) { var pSlot = new PgFreeslot(); MutexEx.Enter(pcache1.mutex); StatusEx.sqlite3StatusAdd(StatusEx.STATUS.PAGECACHE_USED, -1); pSlot._PgHdr = p; pSlot.pNext = pcache1.pFree; pcache1.pFree = pSlot; pcache1.nFreeSlot++; pcache1.bUnderPressure = pcache1.nFreeSlot < pcache1.nReserve; Debug.Assert(pcache1.nFreeSlot <= pcache1.nSlot); MutexEx.Leave(pcache1.mutex); } else { Debug.Assert(SysEx.sqlite3MemdebugHasType(p, SysEx.MEMTYPE.PCACHE)); SysEx.sqlite3MemdebugSetType(p, SysEx.MEMTYPE.HEAP); var iSize = MallocEx.sqlite3MallocSize(p.Data); MutexEx.Enter(pcache1.mutex); StatusEx.sqlite3StatusAdd(StatusEx.STATUS.PAGECACHE_OVERFLOW, -iSize); MutexEx.Leave(pcache1.mutex); MallocEx.sqlite3_free(ref p.Data); } }
public static void sqlite3PageFree(ref byte[] p) { if (p != null) { MallocEx.sqlite3_free(ref p); p = null; } }
// was:sqlite3BtreeClearCursor public void Clear() { Debug.Assert(HoldsMutex()); MallocEx.sqlite3_free(ref this.Key); this.State = CursorState.INVALID; }