xref: /netbsd-src/external/public-domain/sqlite/man/SQLITE_STATUS_MEMORY_USED.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE_STATUS_MEMORY_USED 3
3.Os
4.Sh NAME
5.Nm SQLITE_STATUS_MEMORY_USED ,
6.Nm SQLITE_STATUS_PAGECACHE_USED ,
7.Nm SQLITE_STATUS_PAGECACHE_OVERFLOW ,
8.Nm SQLITE_STATUS_SCRATCH_USED ,
9.Nm SQLITE_STATUS_SCRATCH_OVERFLOW ,
10.Nm SQLITE_STATUS_MALLOC_SIZE ,
11.Nm SQLITE_STATUS_PARSER_STACK ,
12.Nm SQLITE_STATUS_PAGECACHE_SIZE ,
13.Nm SQLITE_STATUS_SCRATCH_SIZE ,
14.Nm SQLITE_STATUS_MALLOC_COUNT
15.Nd status parameters
16.Sh SYNOPSIS
17.In sqlite3.h
18.Fd #define SQLITE_STATUS_MEMORY_USED
19.Fd #define SQLITE_STATUS_PAGECACHE_USED
20.Fd #define SQLITE_STATUS_PAGECACHE_OVERFLOW
21.Fd #define SQLITE_STATUS_SCRATCH_USED
22.Fd #define SQLITE_STATUS_SCRATCH_OVERFLOW
23.Fd #define SQLITE_STATUS_MALLOC_SIZE
24.Fd #define SQLITE_STATUS_PARSER_STACK
25.Fd #define SQLITE_STATUS_PAGECACHE_SIZE
26.Fd #define SQLITE_STATUS_SCRATCH_SIZE
27.Fd #define SQLITE_STATUS_MALLOC_COUNT
28.Sh DESCRIPTION
29These integer constants designate various run-time status parameters
30that can be returned by
31.Fn sqlite3_status .
32.Bl -tag -width Ds
33.It SQLITE_STATUS_MEMORY_USED
34This parameter is the current amount of memory checked out using
35.Fn sqlite3_malloc ,
36either directly or indirectly.
37The figure includes calls made to
38.Fn sqlite3_malloc
39by the application and internal memory usage by the SQLite library.
40Auxiliary page-cache memory controlled by SQLITE_CONFIG_PAGECACHE
41is not included in this parameter.
42The amount returned is the sum of the allocation sizes as reported
43by the xSize method in sqlite3_mem_methods.
44.It SQLITE_STATUS_MALLOC_SIZE
45This parameter records the largest memory allocation request handed
46to
47.Fn sqlite3_malloc
48or
49.Fn sqlite3_realloc
50(or their internal equivalents).
51Only the value returned in the *pHighwater parameter to
52.Fn sqlite3_status
53is of interest.
54The value written into the *pCurrent parameter is undefined.
55.It SQLITE_STATUS_MALLOC_COUNT
56This parameter records the number of separate memory allocations currently
57checked out.
58.It SQLITE_STATUS_PAGECACHE_USED
59This parameter returns the number of pages used out of the pagecache memory allocator
60that was configured using SQLITE_CONFIG_PAGECACHE.
61The value returned is in pages, not in bytes.
62.It SQLITE_STATUS_PAGECACHE_OVERFLOW
63This parameter returns the number of bytes of page cache allocation
64which could not be satisfied by the SQLITE_CONFIG_PAGECACHE
65buffer and where forced to overflow to
66.Fn sqlite3_malloc .
67The returned value includes allocations that overflowed because they
68where too large (they were larger than the "sz" parameter to SQLITE_CONFIG_PAGECACHE)
69and allocations that overflowed because no space was left in the page
70cache.
71.It SQLITE_STATUS_PAGECACHE_SIZE
72This parameter records the largest memory allocation request handed
73to the pagecache memory allocator.
74Only the value returned in the *pHighwater parameter to
75.Fn sqlite3_status
76is of interest.
77The value written into the *pCurrent parameter is undefined.
78.It SQLITE_STATUS_SCRATCH_USED
79No longer used.
80.It SQLITE_STATUS_SCRATCH_OVERFLOW
81No longer used.
82.It SQLITE_STATUS_SCRATCH_SIZE
83No longer used.
84.It SQLITE_STATUS_PARSER_STACK
85The *pHighwater parameter records the deepest parser stack.
86The *pCurrent value is undefined.
87The *pHighwater value is only meaningful if SQLite is compiled with
88YYTRACKMAXSTACKDEPTH.
89.El
90.Pp
91New status parameters may be added from time to time.
92.Sh IMPLEMENTATION NOTES
93These declarations were extracted from the
94interface documentation at line 8549.
95.Bd -literal
96#define SQLITE_STATUS_MEMORY_USED          0
97#define SQLITE_STATUS_PAGECACHE_USED       1
98#define SQLITE_STATUS_PAGECACHE_OVERFLOW   2
99#define SQLITE_STATUS_SCRATCH_USED         3  /* NOT USED */
100#define SQLITE_STATUS_SCRATCH_OVERFLOW     4  /* NOT USED */
101#define SQLITE_STATUS_MALLOC_SIZE          5
102#define SQLITE_STATUS_PARSER_STACK         6
103#define SQLITE_STATUS_PAGECACHE_SIZE       7
104#define SQLITE_STATUS_SCRATCH_SIZE         8  /* NOT USED */
105#define SQLITE_STATUS_MALLOC_COUNT         9
106.Ed
107.Sh SEE ALSO
108.Xr sqlite3_malloc 3 ,
109.Xr sqlite3_mem_methods 3 ,
110.Xr sqlite3_status 3 ,
111.Xr SQLITE_CONFIG_SINGLETHREAD 3
112