xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_memory_used.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_MEMORY_USED 3
3.Os
4.Sh NAME
5.Nm sqlite3_memory_used ,
6.Nm sqlite3_memory_highwater
7.Nd memory allocator statistics
8.Sh SYNOPSIS
9.In sqlite3.h
10.Ft sqlite3_int64
11.Fo sqlite3_memory_used
12.Fa "void"
13.Fc
14.Ft sqlite3_int64
15.Fo sqlite3_memory_highwater
16.Fa "int resetFlag"
17.Fc
18.Sh DESCRIPTION
19SQLite provides these two interfaces for reporting on the status of
20the
21.Fn sqlite3_malloc ,
22.Fn sqlite3_free ,
23and
24.Fn sqlite3_realloc
25routines, which form the built-in memory allocation subsystem.
26.Pp
27The
28.Fn sqlite3_memory_used
29routine returns the number of bytes of memory currently outstanding
30(malloced but not freed).
31The
32.Fn sqlite3_memory_highwater
33routine returns the maximum value of
34.Fn sqlite3_memory_used
35since the high-water mark was last reset.
36The values returned by
37.Fn sqlite3_memory_used
38and
39.Fn sqlite3_memory_highwater
40include any overhead added by SQLite in its implementation of
41.Fn sqlite3_malloc ,
42but not overhead added by the any underlying system library routines
43that
44.Fn sqlite3_malloc
45may call.
46.Pp
47The memory high-water mark is reset to the current value of
48.Fn sqlite3_memory_used
49if and only if the parameter to
50.Fn sqlite3_memory_highwater
51is true.
52The value returned by sqlite3_memory_highwater(1)
53is the high-water mark prior to the reset.
54.Sh IMPLEMENTATION NOTES
55These declarations were extracted from the
56interface documentation at line 3075.
57.Bd -literal
58SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
59SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
60.Ed
61.Sh SEE ALSO
62.Xr sqlite3_malloc 3
63