xref: /netbsd-src/external/public-domain/sqlite/man/SQLITE_STATUS_MEMORY_USED.3 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.Dd March 11, 2017
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.Fd #define SQLITE_STATUS_MEMORY_USED
18.Fd #define SQLITE_STATUS_PAGECACHE_USED
19.Fd #define SQLITE_STATUS_PAGECACHE_OVERFLOW
20.Fd #define SQLITE_STATUS_SCRATCH_USED
21.Fd #define SQLITE_STATUS_SCRATCH_OVERFLOW
22.Fd #define SQLITE_STATUS_MALLOC_SIZE
23.Fd #define SQLITE_STATUS_PARSER_STACK
24.Fd #define SQLITE_STATUS_PAGECACHE_SIZE
25.Fd #define SQLITE_STATUS_SCRATCH_SIZE
26.Fd #define SQLITE_STATUS_MALLOC_COUNT
27.Sh DESCRIPTION
28These integer constants designate various run-time status parameters
29that can be returned by sqlite3_status().
30.Bl -tag -width Ds
31.It SQLITE_STATUS_MEMORY_USED
32This parameter is the current amount of memory checked out using sqlite3_malloc(),
33either directly or indirectly.
34The figure includes calls made to sqlite3_malloc()
35by the application and internal memory usage by the SQLite library.
36Scratch memory controlled by SQLITE_CONFIG_SCRATCH
37and auxiliary page-cache memory controlled by SQLITE_CONFIG_PAGECACHE
38is not included in this parameter.
39The amount returned is the sum of the allocation sizes as reported
40by the xSize method in sqlite3_mem_methods.
41.It SQLITE_STATUS_MALLOC_SIZE
42This parameter records the largest memory allocation request handed
43to sqlite3_malloc() or sqlite3_realloc()
44(or their internal equivalents).
45Only the value returned in the *pHighwater parameter to sqlite3_status()
46is of interest.
47The value written into the *pCurrent parameter is undefined.
48.It SQLITE_STATUS_MALLOC_COUNT
49This parameter records the number of separate memory allocations currently
50checked out.
51.It SQLITE_STATUS_PAGECACHE_USED
52This parameter returns the number of pages used out of the pagecache memory allocator
53that was configured using SQLITE_CONFIG_PAGECACHE.
54The value returned is in pages, not in bytes.
55.It SQLITE_STATUS_PAGECACHE_OVERFLOW
56This parameter returns the number of bytes of page cache allocation
57which could not be satisfied by the SQLITE_CONFIG_PAGECACHE
58buffer and where forced to overflow to sqlite3_malloc().
59The returned value includes allocations that overflowed because they
60where too large (they were larger than the "sz" parameter to SQLITE_CONFIG_PAGECACHE)
61and allocations that overflowed because no space was left in the page
62cache.
63.It SQLITE_STATUS_PAGECACHE_SIZE
64This parameter records the largest memory allocation request handed
65to pagecache memory allocator.
66Only the value returned in the *pHighwater parameter to sqlite3_status()
67is of interest.
68The value written into the *pCurrent parameter is undefined.
69.It SQLITE_STATUS_SCRATCH_USED
70This parameter returns the number of allocations used out of the scratch memory allocator
71configured using SQLITE_CONFIG_SCRATCH.
72The value returned is in allocations, not in bytes.
73Since a single thread may only have one scratch allocation outstanding
74at time, this parameter also reports the number of threads using scratch
75memory at the same time.
76.It SQLITE_STATUS_SCRATCH_OVERFLOW
77This parameter returns the number of bytes of scratch memory allocation
78which could not be satisfied by the SQLITE_CONFIG_SCRATCH
79buffer and where forced to overflow to sqlite3_malloc().
80The values returned include overflows because the requested allocation
81was too larger (that is, because the requested allocation was larger
82than the "sz" parameter to SQLITE_CONFIG_SCRATCH)
83and because no scratch buffer slots were available.
84.It SQLITE_STATUS_SCRATCH_SIZE
85This parameter records the largest memory allocation request handed
86to scratch memory allocator.
87Only the value returned in the *pHighwater parameter to sqlite3_status()
88is of interest.
89The value written into the *pCurrent parameter is undefined.
90.It SQLITE_STATUS_PARSER_STACK
91The *pHighwater parameter records the deepest parser stack.
92The *pCurrent value is undefined.
93The *pHighwater value is only meaningful if SQLite is compiled with
94YYTRACKMAXSTACKDEPTH.
95.El
96.Pp
97New status parameters may be added from time to time.
98.Sh SEE ALSO
99.Xr sqlite3_malloc 3 ,
100.Xr sqlite3_mem_methods 3 ,
101.Xr sqlite3_malloc 3 ,
102.Xr sqlite3_status 3 ,
103.Xr SQLITE_CONFIG_SINGLETHREAD 3
104