.Dd January 24, 2024
.Dt SQLITE_STATUS_MEMORY_USED 3
.Os
.Sh NAME
.Nm SQLITE_STATUS_MEMORY_USED ,
.Nm SQLITE_STATUS_PAGECACHE_USED ,
.Nm SQLITE_STATUS_PAGECACHE_OVERFLOW ,
.Nm SQLITE_STATUS_SCRATCH_USED ,
.Nm SQLITE_STATUS_SCRATCH_OVERFLOW ,
.Nm SQLITE_STATUS_MALLOC_SIZE ,
.Nm SQLITE_STATUS_PARSER_STACK ,
.Nm SQLITE_STATUS_PAGECACHE_SIZE ,
.Nm SQLITE_STATUS_SCRATCH_SIZE ,
.Nm SQLITE_STATUS_MALLOC_COUNT
.Nd status parameters
.Sh SYNOPSIS
.In sqlite3.h
.Fd #define SQLITE_STATUS_MEMORY_USED
.Fd #define SQLITE_STATUS_PAGECACHE_USED
.Fd #define SQLITE_STATUS_PAGECACHE_OVERFLOW
.Fd #define SQLITE_STATUS_SCRATCH_USED
.Fd #define SQLITE_STATUS_SCRATCH_OVERFLOW
.Fd #define SQLITE_STATUS_MALLOC_SIZE
.Fd #define SQLITE_STATUS_PARSER_STACK
.Fd #define SQLITE_STATUS_PAGECACHE_SIZE
.Fd #define SQLITE_STATUS_SCRATCH_SIZE
.Fd #define SQLITE_STATUS_MALLOC_COUNT
.Sh DESCRIPTION
These integer constants designate various run-time status parameters
that can be returned by
.Fn sqlite3_status .
.Bl -tag -width Ds
.It SQLITE_STATUS_MEMORY_USED
This parameter is the current amount of memory checked out using
.Fn sqlite3_malloc ,
either directly or indirectly.
The figure includes calls made to
.Fn sqlite3_malloc
by the application and internal memory usage by the SQLite library.
Auxiliary page-cache memory controlled by SQLITE_CONFIG_PAGECACHE
is not included in this parameter.
The amount returned is the sum of the allocation sizes as reported
by the xSize method in sqlite3_mem_methods.
.It SQLITE_STATUS_MALLOC_SIZE
This parameter records the largest memory allocation request handed
to
.Fn sqlite3_malloc
or
.Fn sqlite3_realloc
(or their internal equivalents).
Only the value returned in the *pHighwater parameter to
.Fn sqlite3_status
is of interest.
The value written into the *pCurrent parameter is undefined.
.It SQLITE_STATUS_MALLOC_COUNT
This parameter records the number of separate memory allocations currently
checked out.
.It SQLITE_STATUS_PAGECACHE_USED
This parameter returns the number of pages used out of the pagecache memory allocator
that was configured using SQLITE_CONFIG_PAGECACHE.
The value returned is in pages, not in bytes.
.It SQLITE_STATUS_PAGECACHE_OVERFLOW
This parameter returns the number of bytes of page cache allocation
which could not be satisfied by the SQLITE_CONFIG_PAGECACHE
buffer and where forced to overflow to
.Fn sqlite3_malloc .
The returned value includes allocations that overflowed because they
where too large (they were larger than the "sz" parameter to SQLITE_CONFIG_PAGECACHE)
and allocations that overflowed because no space was left in the page
cache.
.It SQLITE_STATUS_PAGECACHE_SIZE
This parameter records the largest memory allocation request handed
to the pagecache memory allocator.
Only the value returned in the *pHighwater parameter to
.Fn sqlite3_status
is of interest.
The value written into the *pCurrent parameter is undefined.
.It SQLITE_STATUS_SCRATCH_USED
No longer used.
.It SQLITE_STATUS_SCRATCH_OVERFLOW
No longer used.
.It SQLITE_STATUS_SCRATCH_SIZE
No longer used.
.It SQLITE_STATUS_PARSER_STACK
The *pHighwater parameter records the deepest parser stack.
The *pCurrent value is undefined.
The *pHighwater value is only meaningful if SQLite is compiled with
YYTRACKMAXSTACKDEPTH.
.El
.Pp
New status parameters may be added from time to time.
.Sh IMPLEMENTATION NOTES
These declarations were extracted from the
interface documentation at line 8549.
.Bd -literal
#define SQLITE_STATUS_MEMORY_USED          0
#define SQLITE_STATUS_PAGECACHE_USED       1
#define SQLITE_STATUS_PAGECACHE_OVERFLOW   2
#define SQLITE_STATUS_SCRATCH_USED         3  /* NOT USED */
#define SQLITE_STATUS_SCRATCH_OVERFLOW     4  /* NOT USED */
#define SQLITE_STATUS_MALLOC_SIZE          5
#define SQLITE_STATUS_PARSER_STACK         6
#define SQLITE_STATUS_PAGECACHE_SIZE       7
#define SQLITE_STATUS_SCRATCH_SIZE         8  /* NOT USED */
#define SQLITE_STATUS_MALLOC_COUNT         9
.Ed
.Sh SEE ALSO
.Xr sqlite3_malloc 3 ,
.Xr sqlite3_mem_methods 3 ,
.Xr sqlite3_status 3 ,
.Xr SQLITE_CONFIG_SINGLETHREAD 3
