On Wed, 7 Jan 2009 10:25:12 -0800, ed <epdm...@gmail.com>
wrote in General Discussion of SQLite Database
<sqlite-users@sqlite.org>:

>Hello, I did not receive a reply to my question.Does anyone have any
>information on this?

Apparently not.
I am not much of a source hacker, but perhaps you are.
You might be able to intercept allocation and free calls and
keep tallies per active database handle. You would have to
add a few entrypoints for this.

In short:
Setup a hash table with counters for current and maximum
allocation, use db handle as a key in the hashtable.

Add an entrypoint that registers which db handle will be
used in the next sqlite3_* call. Call that entrypoint before
every sqlite3_* call.

Add code to the "allocate" entrypoint:
        increment the current and maximum memory 
        counter for the currently active db handle.

Add code to the "free" entrypoint:
        decrement the current memory counter 
        for the currently active db handle

Add an entrypoint to report the contents of the hashtable.

>thanks,
>ed
>
>---------- Forwarded message ----------
>From: ed <epdm...@gmail.com>
>Date: Tue, Dec 30, 2008 at 10:02 AM
>Subject: memory usage
>To: sqlite-users@sqlite.org
>
>
>Hello,
>My multi-threaded application has various sqlite db's open simultaneously,
>in memory using the :memory: keyword, disk based db's and at times, tmpfs
>(ram) db's. Is there a way to view each individual database's memory usage?
>
>I found the functions sqlite3_memory_used() and
>sqlite3_status(SQLITE_STATUS_MEMORY_USED, ...) but these look like they
>provide memory statistics for all of sqlite, not per database.
>
>thanks,
>ed

Hope this helps.
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to