1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Add the SQLITE_STATUS_MALLOC_COUNT option for sqlite3_status().

FossilOrigin-Name: 8f8e442b3af553753e25c304efa289b626e3a227
This commit is contained in:
drh
2010-07-26 18:43:40 +00:00
parent d2de9f4e68
commit eafc43b156
7 changed files with 27 additions and 18 deletions

View File

@ -441,8 +441,10 @@ proc finalize_testing {} {
puts "$sqlite_open_file_count files were left open"
incr nErr
}
if {[sqlite3_memory_used]>0} {
puts "Unfreed memory: [sqlite3_memory_used] bytes"
if {[lindex [sqlite3_status SQLITE_STATUS_MALLOC_COUNT 0] 1]>0 ||
[sqlite3_memory_used]>0} {
puts "Unfreed memory: [sqlite3_memory_used] bytes in\
[lindex [sqlite3_status SQLITE_STATUS_MALLOC_COUNT 0] 1] allocations"
incr nErr
ifcapable memdebug||mem5||(mem3&&debug) {
puts "Writing unfreed memory log to \"./memleak.txt\""
@ -489,6 +491,9 @@ proc show_memstats {} {
set val [format {now %10d max %10d max-size %10d} \
[lindex $x 1] [lindex $x 2] [lindex $y 2]]
puts "Memory used: $val"
set x [sqlite3_status SQLITE_STATUS_MALLOC_COUNT 0]
set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]]
puts "Allocation count: $val"
set x [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0]
set y [sqlite3_status SQLITE_STATUS_PAGECACHE_SIZE 0]
set val [format {now %10d max %10d max-size %10d} \