diff options
author | drh <drh@noemail.net> | 2014-08-23 19:42:06 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2014-08-23 19:42:06 +0000 |
commit | b4586f1254df07a7eccba2101ae4a95dfe2ca34b (patch) | |
tree | 5eef6120946c9e84d4ecf6d96c5aefd8dc201994 /src | |
parent | 3bdffddc418b3b202d48eff685780eba2af24465 (diff) | |
download | sqlite-b4586f1254df07a7eccba2101ae4a95dfe2ca34b.tar.gz sqlite-b4586f1254df07a7eccba2101ae4a95dfe2ca34b.zip |
Another memory allocator performance optimization.
FossilOrigin-Name: 6da6f46d0c43e3b68c21f514ddf8ee663c20f249
Diffstat (limited to 'src')
-rw-r--r-- | src/malloc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/malloc.c b/src/malloc.c index f3b317da5..1b219604b 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -478,6 +478,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) ){ |