Hi Folks,

This is the little hack, where you can free up the memory, inside
*btree.h*enable the SQLITE_DEFAULT_AUTOVACUUM to 1, and inside
*btree.c*, make sure to pBt->autoVacuum = SQLITE_DEFAULT_AUTOVACUUM; enable
this statement. The statement is in *if* block, so you need to put outside.

This solution gives perfect memory results even after delete, update,
replace, drop etc has been done.

If *delete *is done it should free up the memory, but it was keeping the
contents, particularly if I'm using In-Memory database I need that memory to
be freed and give room for other records.

BTW thanks for everyone who replied. The requirement is for a small realtime
embedded device. I don't want rollback or anything to happen, as database
will reside on memory and it will not be dumped on disk or anywhere, if the
device is rebooted the database will be created afresh.

If anybody has better solution, please let me know.


On 8/9/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
>
> --- "Babu, Lokesh" <[EMAIL PROTECTED]> wrote:
> > Does anybody knows the exact code, a little hack where can I free up the
> > memory, I don't want it to use it for future requests.
> >
> > Even drop table consumes memory. :-(.
> >
> > If we are doing in-memory database operation, why do we want to maintain
> the
> > free'd memory pages?
>
> On Linux using sqlite 3.4.1:
>
> -- start sqlite3 shell
>
> -- 2m VIRT, 1m RES
>
> pragma temp_store=memory;
> CREATE TABLE abc(a,b,c);
> INSERT INTO "abc" VALUES(5400,'some dumb phrase to fill stuff',-345.7);
> INSERT INTO "abc" VALUES(-1234,'the quick brown fox', 20394203492340.5);
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
> insert into abc select * from abc;
>
> -- 167m VIRT, 166m RES
>
> delete from abc where a != b;
>
> -- 200m VIRT, 199m RES peak usage during delete
>
> -- 167m VIRT, 166m RES after delete
>
> vacuum;
>
> -- 18m VIRT, 1m RES
>
> Are you seeing different results?
>
>
>
>
> ____________________________________________________________________________________Ready
> for the edge of your seat?
> Check out tonight's top picks on Yahoo! TV.
> http://tv.yahoo.com/
>
>
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -----------------------------------------------------------------------------
>
>

Reply via email to