Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Memory Allocator Statistics

sqlite3_int64 sqlite3_memory_used(void);
sqlite3_int64 sqlite3_memory_highwater(int resetFlag);

In addition to the basic three allocation routines sqlite3_malloc(), sqlite3_free(), and sqlite3_realloc(), the memory allocation subsystem included with the SQLite sources provides the interfaces shown here.

The sqlite3_memory_used() routine returns the number of bytes of memory currently outstanding (malloced but not freed). The value returned by sqlite3_memory_used() includes any overhead added by SQLite, but not overhead added by the library malloc() that backs the sqlite3_malloc() implementation. The sqlite3_memory_highwater() routines returns the maximum number of bytes that have been outstanding at any time since the highwater mark was last reset. The byte count returned by sqlite3_memory_highwater() uses the same byte counting rules as sqlite3_memory_used(). In other words, overhead added internally by SQLite is counted, but overhead from the underlying system malloc is not. If the parameter to sqlite3_memory_highwater() is true, then the highwater mark is reset to the current value of sqlite3_memory_used() and the prior highwater mark (before the reset) is returned. If the parameter to sqlite3_memory_highwater() is zero, then the highwater mark is unchanged.

See also lists of Objects, Constants, and Functions.


This page last modified 2007/12/14 14:37:57 UTC