sqlite3_int64 sqlite3_memory_used(void); sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
SQLite 提供以下兩個介面,用於報告內建記憶體配置子系統 sqlite3_malloc()、sqlite3_free() 和 sqlite3_realloc() 函式的狀態。
sqlite3_memory_used() 函式會回傳目前已配置但尚未釋放的記憶體位元組數。sqlite3_memory_highwater() 函式會回傳自上次重設最高水位線以來 sqlite3_memory_used() 的最大值。sqlite3_memory_used() 和 sqlite3_memory_highwater() 回傳的值包含 SQLite 在其實作 sqlite3_malloc() 時新增的任何額外負荷,但不包含 sqlite3_malloc() 可能呼叫的任何底層系統函式庫例程所新增的額外負荷。
記憶體最高水位線若且唯若 sqlite3_memory_highwater() 的參數為 true 時才會重設為 sqlite3_memory_used() 的目前值。sqlite3_memory_highwater(1) 回傳的值是重設前的最高水位線。