Re: [sqlite] sqlite3_release_memory Question
Shawn Wilsher wrote: > That got me looking into sqlite3_release_memory. DRH would need to answer this precisely, but I believe that SQLite will free up almost all memory anyway if you have called sqlite3_close() on all open handles. Roger - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] sqlite3_release_memory Question
"Shawn Wilsher" <[EMAIL PROTECTED]> wrote: > Hmm, the documentation (http://sqlite.org/compile.html) doesn't seem > to say anything about [sqlite3_release_memory() only working if > SQLITE_ENABLE_MEMORY_MANAGEMENT=1 is used]. Is there a cost to > pay by enabling those functions, or no? > There is extra overhead associated with SQLITE_ENABLE_MEMORY_MANAGEMENT. I just ran some tests using the latest code in CVS on SuSE 10.1 and gcc 4.1.0 with -O6 (non-amalgamation). For the workload I used the mix of operations found in the speed2.test test file in the source tree. +TS means SQLITE_THREADSAFE=1. -TS means SQLITE_THREADSAFE=0. +MM means SQLITE_ENABLE_MEMORY_MANAGEMENT=1 is defined. -MM means it is not. Configuration Raw-Time Normalized -TS -MM 34427759 100 -TS +MM 35589951 103 +TS -MM 38751594 113 +TS +MM 41907742 122 So it appears that with threadsafe disabled, the performance hit for memory management is only about 3%. With threading enabled, the hit is more like 9%. This makes sense because there is additional mutexing that has to occur when managing the memory pool across multiple threads. -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] sqlite3_release_memory Question
Hmm, the documentation (http://sqlite.org/compile.html) doesn't seem to say anything about that. Is there a cost to pay by enabling those functions, or no? Cheers, Shawn On Jan 11, 2008 8:42 AM, <[EMAIL PROTECTED]> wrote: > "Shawn Wilsher" <[EMAIL PROTECTED]> wrote: > > Hey all, > > > > Over in Mozilla land, we are looking for ways to free up as much > > memory as possible on demand. That got me looking into > > sqlite3_release_memory. However, the docs say that it tries to free > > up to N bytes, but that it could free more or less. My question is, > > how do we get it to free as much as possible, or does it do that > > automatically regardless of the value you provide to it? > > > > To release as much memory as possible, just call > >sqlite3_release_memory(0x7fff); > > Or, if you think you might have more than 2GiB of > memory in use: > >while( sqlite3_release_memory(0x7fff)>0 ){} > > Please note, however, that sqlite3_release_memory() is > a no-op unless you compile with -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1. > -- > D. Richard Hipp <[EMAIL PROTECTED]> > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] sqlite3_release_memory Question
"Shawn Wilsher" <[EMAIL PROTECTED]> wrote: > Hey all, > > Over in Mozilla land, we are looking for ways to free up as much > memory as possible on demand. That got me looking into > sqlite3_release_memory. However, the docs say that it tries to free > up to N bytes, but that it could free more or less. My question is, > how do we get it to free as much as possible, or does it do that > automatically regardless of the value you provide to it? > To release as much memory as possible, just call sqlite3_release_memory(0x7fff); Or, if you think you might have more than 2GiB of memory in use: while( sqlite3_release_memory(0x7fff)>0 ){} Please note, however, that sqlite3_release_memory() is a no-op unless you compile with -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1. -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] sqlite3_release_memory Question
Hey all, Over in Mozilla land, we are looking for ways to free up as much memory as possible on demand. That got me looking into sqlite3_release_memory. However, the docs say that it tries to free up to N bytes, but that it could free more or less. My question is, how do we get it to free as much as possible, or does it do that automatically regardless of the value you provide to it? For reference purposes, the Mozilla tracker for this is Bug 411894 (https://bugzilla.mozilla.org/show_bug.cgi?id=411894). Cheers, Shawn Wilsher - To unsubscribe, send email to [EMAIL PROTECTED] -