Re: [sqlite] Default sqlite memory management policy

2007-04-05 Thread Rich Rattanni

On 4/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

"Rich Rattanni" <[EMAIL PROTECTED]> wrote:
>
> I am just wondering should I take matters into my own hands,
> and compile and make use of sqlite3_soft_heap_limit(), or can I trust
> SQLITE to manage it for me.

If you do not set sqlite3_soft_heap_limit(), SQLite assumes
you are on a workstation with essentially unlimited memory
and will use as much memory as it needs to run most efficiently.

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Thank you sir.  I shall recompile and use this option.

--
Rich

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Default sqlite memory management policy

2007-04-05 Thread drh
"Rich Rattanni" <[EMAIL PROTECTED]> wrote:
> 
> I am just wondering should I take matters into my own hands,
> and compile and make use of sqlite3_soft_heap_limit(), or can I trust
> SQLITE to manage it for me.

If you do not set sqlite3_soft_heap_limit(), SQLite assumes
you are on a workstation with essentially unlimited memory
and will use as much memory as it needs to run most efficiently.

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Default sqlite memory management policy

2007-04-05 Thread Rich Rattanni

On 4/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

"Rich Rattanni" <[EMAIL PROTECTED]> wrote:
> On 4/3/07, Rich Rattanni <[EMAIL PROTECTED]> wrote:
> > All:
> >I was wondering exactly how SQLite handles freeing memory used
> > from the heap when compiled without SQLITE_ENABLE_MEMORY_MANAGEMENT?
> >
> >Will absolutely no memory be freed, or is there some default
> > memory management scheme used?
> >
>
> Let me explain my question better...
> SQLITE on my system has been compiled without the
> SQLITE_ENABLE_MEMORY_MANAGEMENT define.  I have a thread that writes a
> hundred or so samples into a database every 30 seconds.  I do not open
> and close the database pointer each time, but I do prepare and
> finalize a statement for each transaction.  I have notices that the
> memory used by my program slowly but surely increases as the program
> runs (about 24 hrs sees a 40%+ increase in system memory).  I have
> checked, and rechecked the program for any memory leaks on my part,
> but I have no found any obvious ones.  I just wanted to know if
> sqlite, as compiled for my system, will use as much memory as it sees
> fit in a particular thread if compiled without
> SQLITE_ENABLE_MEMORY_MANAGEMENT?
>
> Can anyone answer this for me?
>

SQLite does not leak memory, if that what you are asking.
You do not need to compile with SQLITE_ENABLE_MEMORY_MANAGEMENT
in order to prevent memory leaks.

The SQLITE_ENABLE_MEMORY_MANAGEMENT macro is used to enable
two APIs used for tighter control of memory on resource
limited embedded devices:

sqlite3_release_memory()
sqlite3_soft_heap_limit()

I recommend you run your program in valgrind to find out where
the memory is leaking.

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-




Sorry I was not implying that SQLite leaked memory, but I would
consider it ok behavior if SQLite was allowed to use some reasonably
large amount of system memory as long as you kept a pointer to the
database open (for caching, etc).   And then closing the pointer
freeded that memory.



The SQLITE_ENABLE_MEMORY_MANAGEMENT macro is used to enable
two APIs used for tighter control of memory on resource
limited embedded devices:


Compiled without SQLITE_ENABLE_MEMORY_MANAGEMENT, what policy does
SQLite use regarding heap memory usage?  (this is a limited embedded
device).  I am just wondering should I take matters into my own hands,
and compile and make use of sqlite3_soft_heap_limit(), or can I trust
SQLITE to manage it for me.

Also, Valgrind is not an option, since there is no ARM port yet, but
they are hastly working on it.

Thank you for your reply,
Rich

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Default sqlite memory management policy

2007-04-04 Thread drh
"Rich Rattanni" <[EMAIL PROTECTED]> wrote:
> On 4/3/07, Rich Rattanni <[EMAIL PROTECTED]> wrote:
> > All:
> >I was wondering exactly how SQLite handles freeing memory used
> > from the heap when compiled without SQLITE_ENABLE_MEMORY_MANAGEMENT?
> >
> >Will absolutely no memory be freed, or is there some default
> > memory management scheme used?
> >
> 
> Let me explain my question better...
> SQLITE on my system has been compiled without the
> SQLITE_ENABLE_MEMORY_MANAGEMENT define.  I have a thread that writes a
> hundred or so samples into a database every 30 seconds.  I do not open
> and close the database pointer each time, but I do prepare and
> finalize a statement for each transaction.  I have notices that the
> memory used by my program slowly but surely increases as the program
> runs (about 24 hrs sees a 40%+ increase in system memory).  I have
> checked, and rechecked the program for any memory leaks on my part,
> but I have no found any obvious ones.  I just wanted to know if
> sqlite, as compiled for my system, will use as much memory as it sees
> fit in a particular thread if compiled without
> SQLITE_ENABLE_MEMORY_MANAGEMENT?
> 
> Can anyone answer this for me?
> 

SQLite does not leak memory, if that what you are asking.
You do not need to compile with SQLITE_ENABLE_MEMORY_MANAGEMENT
in order to prevent memory leaks.

The SQLITE_ENABLE_MEMORY_MANAGEMENT macro is used to enable
two APIs used for tighter control of memory on resource
limited embedded devices:

sqlite3_release_memory()
sqlite3_soft_heap_limit()

I recommend you run your program in valgrind to find out where
the memory is leaking.

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Default sqlite memory management policy

2007-04-03 Thread Rich Rattanni

All:
   I was wondering exactly how SQLite handles freeing memory used
from the heap when compiled without SQLITE_ENABLE_MEMORY_MANAGEMENT?

   Will absolutely no memory be freed, or is there some default
memory management scheme used?

-
To unsubscribe, send email to [EMAIL PROTECTED]
-