Hi,

I am using SQLite in a embedded system which has the following databases
    1. 64MB Flash stored Database for persistent storage
    2. 2 MB In-Memory Database.

When the Memory Database is closed the 2MB should be returned to the
operating system. The 2 MB will be reallocated when the system wants to use
the mem db. SQLite currently does not support freeing of allocated memory
unless it is shutdown.


To implement the above requirement I am planning to do as follows

In SQLite Page cache module i.e pcahe1.c handles the datbase buffering of
both persistent storage and in-memory storage.
To identify whether the database is mem or file there is a flag bPurgeable
in struct PCache1.

The pages for cache are allocated in functions
    1. pcache1AllocPage
    2. pcache1FreePage

Add 2 new configuration variables
   1. SQLITE_CONFIG_MEMDB - Enables separate memory DB with the default
values
   2. SQLITE_CONFIG_MEMSIZE- Configures the mem db with user specified
memory block. Similar to the config variable
      SQLITE_CONFIG_PAGECACHE

Using bPurgeable in pcache1AllocPage identify the mem db, If memdb then use
the mem block specified by the user.
The algorithm for the page allocation will be same as the list
implementation present for the SQLITE_CONFIG_PAGECACHE

Please provide comments or suggestion.

Thanks
Shankar
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to