Add the SQLITE_STATUS_MALLOC_COUNT option for sqlite3_status().
FossilOrigin-Name: 8f8e442b3af553753e25c304efa289b626e3a227
This commit is contained in:
parent
d2de9f4e68
commit
eafc43b156
26
manifest
26
manifest
@ -1,8 +1,8 @@
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA1
|
||||
|
||||
C Increase\sthe\sversion\snumber\sto\s3.7.1\sdue\sto\sthe\sAPI\senhancement\sof\sthe\sprevious\ncheck-in.
|
||||
D 2010-07-26T16:40:04
|
||||
C Add\sthe\sSQLITE_STATUS_MALLOC_COUNT\soption\sfor\ssqlite3_status().
|
||||
D 2010-07-26T18:43:41
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -139,7 +139,7 @@ F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
|
||||
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
|
||||
F src/loadext.c 6d422ea91cf3d2d00408c5a8f2391cd458da85f8
|
||||
F src/main.c a487fe90aecaccb142e4a6b738c7e26e99145bcd
|
||||
F src/malloc.c 9d7dc6a52aa13ba3639eb40c573dd7adb3a16813
|
||||
F src/malloc.c 52c19b9ea68aaad4e0ab8d0722ec448660e7a151
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c 89d4ea8d5cdd55635cbaa48ad53132af6294cbb2
|
||||
F src/mem2.c 12c91260fd2320eda9355dea5445b137f848c05b
|
||||
@ -173,11 +173,11 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
|
||||
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
||||
F src/select.c 74fef1334bec27e606ef0b19e5c41cd0a639e69c
|
||||
F src/shell.c fd4ccdb37c3b68de0623eb938a649e0990710714
|
||||
F src/sqlite.h.in e789728101d821fd4307208aa11e332e51eedbf9
|
||||
F src/sqlite.h.in 5bc6d2d1bc5251b887123b12b67895785ff41a5f
|
||||
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
|
||||
F src/sqliteInt.h a9be6badc6cd6a3c1ae54475a98661cf351ecad5
|
||||
F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3
|
||||
F src/status.c 51f65ba9768846c071fa621624d55d6866fce28b
|
||||
F src/status.c f61b49b65fc0c681298e9b123c5ff1fc3f3a5662
|
||||
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
||||
F src/tclsqlite.c ae1e4fb653c91ddad7e2534d209711a12604ccc4
|
||||
F src/test1.c ff3b4533fc4d78d1bff2ef831a5791db55096ed3
|
||||
@ -203,7 +203,7 @@ F src/test_intarray.c d879bbf8e4ce085ab966d1f3c896a7c8b4f5fc99
|
||||
F src/test_intarray.h 489edb9068bb926583445cb02589344961054207
|
||||
F src/test_journal.c 424a334cdfdc8a6f975abe3641440147bded3185
|
||||
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
|
||||
F src/test_malloc.c 76bce0d5846dbfc9f24a65efab781b1ffb441380
|
||||
F src/test_malloc.c 058e41dc853b1fa8ccd1083e9571018a74aeb3a7
|
||||
F src/test_mutex.c ce06b59aca168cd8c520b77159a24352a7469bd3
|
||||
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
|
||||
F src/test_osinst.c f408c6a181f2fb04c56273afd5c3e1e82f60392c
|
||||
@ -622,7 +622,7 @@ F test/tclsqlite.test 8c154101e704170c2be10f137a5499ac2c6da8d3
|
||||
F test/tempdb.test 800c36623d67a2ad1f58784b9c5644e0405af6e6
|
||||
F test/temptable.test f42121a0d29a62f00f93274464164177ab1cc24a
|
||||
F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05
|
||||
F test/tester.tcl cab2b46972cd50c3939a0e30e0b37e73f558bc2d
|
||||
F test/tester.tcl bc01480bbf2e948b52da8943fedc4237b0735961
|
||||
F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f
|
||||
F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db
|
||||
F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca
|
||||
@ -841,14 +841,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P 008368b2bd1513e2df21c2070548c6fc94abebb1
|
||||
R e0e547721eadb5865947ac95d9a5637b
|
||||
P 1d7571e4be6d96aec13cd8b3b7b10b8dc44d19a5
|
||||
R 9d00d63ded465dd4ba007fd57cd90c94
|
||||
U drh
|
||||
Z b2f076ca75f409c11b1173e904fc1e43
|
||||
Z 97b8e702c8fc82f2c81b86c540c762cb
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.6 (GNU/Linux)
|
||||
|
||||
iD8DBQFMTbpnoxKgR168RlERAgRsAKCEDv9PrVdoUqb+GgrX9p308vOjrgCgi4/A
|
||||
Wv1UV7AZmSjiGasHOtjRZXM=
|
||||
=082N
|
||||
iD8DBQFMTddhoxKgR168RlERAjMdAJ9CQU8kCdBo5Cl1oO/prGACkzVGEgCgjc6P
|
||||
yq0ZsmI2azw9P5tIzO1YjII=
|
||||
=HMXo
|
||||
-----END PGP SIGNATURE-----
|
||||
|
@ -1 +1 @@
|
||||
1d7571e4be6d96aec13cd8b3b7b10b8dc44d19a5
|
||||
8f8e442b3af553753e25c304efa289b626e3a227
|
@ -251,6 +251,7 @@ static int mallocWithAlarm(int n, void **pp){
|
||||
if( p ){
|
||||
nFull = sqlite3MallocSize(p);
|
||||
sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nFull);
|
||||
sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, 1);
|
||||
}
|
||||
*pp = p;
|
||||
return nFull;
|
||||
@ -446,6 +447,7 @@ void sqlite3_free(void *p){
|
||||
if( sqlite3GlobalConfig.bMemstat ){
|
||||
sqlite3_mutex_enter(mem0.mutex);
|
||||
sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -sqlite3MallocSize(p));
|
||||
sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, -1);
|
||||
sqlite3GlobalConfig.m.xFree(p);
|
||||
sqlite3_mutex_leave(mem0.mutex);
|
||||
}else{
|
||||
|
@ -5204,6 +5204,7 @@ int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
|
||||
#define SQLITE_STATUS_PARSER_STACK 6
|
||||
#define SQLITE_STATUS_PAGECACHE_SIZE 7
|
||||
#define SQLITE_STATUS_SCRATCH_SIZE 8
|
||||
#define SQLITE_STATUS_MALLOC_COUNT 9
|
||||
|
||||
/*
|
||||
** CAPI3REF: Database Connection Status
|
||||
|
@ -21,8 +21,8 @@
|
||||
*/
|
||||
typedef struct sqlite3StatType sqlite3StatType;
|
||||
static SQLITE_WSD struct sqlite3StatType {
|
||||
int nowValue[9]; /* Current value */
|
||||
int mxValue[9]; /* Maximum value */
|
||||
int nowValue[10]; /* Current value */
|
||||
int mxValue[10]; /* Maximum value */
|
||||
} sqlite3Stat = { {0,}, {0,} };
|
||||
|
||||
|
||||
|
@ -1237,6 +1237,7 @@ static int test_status(
|
||||
{ "SQLITE_STATUS_SCRATCH_OVERFLOW", SQLITE_STATUS_SCRATCH_OVERFLOW },
|
||||
{ "SQLITE_STATUS_SCRATCH_SIZE", SQLITE_STATUS_SCRATCH_SIZE },
|
||||
{ "SQLITE_STATUS_PARSER_STACK", SQLITE_STATUS_PARSER_STACK },
|
||||
{ "SQLITE_STATUS_MALLOC_COUNT", SQLITE_STATUS_MALLOC_COUNT },
|
||||
};
|
||||
Tcl_Obj *pResult;
|
||||
if( objc!=3 ){
|
||||
|
@ -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} \
|
||||
|
Loading…
x
Reference in New Issue
Block a user