1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-09-11 08:30:57 +03:00

Another memory allocator performance optimization.

FossilOrigin-Name: 6da6f46d0c43e3b68c21f514ddf8ee663c20f249
This commit is contained in:
drh
2014-08-23 19:42:06 +00:00
parent 3bdffddc41
commit b4586f1254
3 changed files with 16 additions and 8 deletions

View File

@@ -477,6 +477,14 @@ void sqlite3_free(void *p){
}
}
/*
** Add the size of memory allocation "p" to the count in
** *db->pnBytesFreed.
*/
static SQLITE_NOINLINE void measureAllocationSize(sqlite3 *db, void *p){
*db->pnBytesFreed += sqlite3DbMallocSize(db,p);
}
/*
** Free memory that might be associated with a particular database
** connection.
@@ -486,7 +494,7 @@ void sqlite3DbFree(sqlite3 *db, void *p){
if( p==0 ) return;
if( db ){
if( db->pnBytesFreed ){
*db->pnBytesFreed += sqlite3DbMallocSize(db, p);
measureAllocationSize(db, p);
return;
}
if( isLookaside(db, p) ){