On Aug 15, 2008, at 9:56 AM, [EMAIL PROTECTED] wrote:
>
> I don’t dare to use the term “leak” here. It is hard so say at the
> moment where the memory is going to. At least, the
> memory is not freed when sqlite3_finalize() is called on the
> statement. Might it be possible, that this memory is
> allocated once per attached database and used for caching reasons?
>
Memory leaks in SQLite are uncommon. Especially 2.5MB memory leaks. See
http://www.sqlite.org/malloc.html#testing
Are you sure that the memory is not freed? Calling free() does not
normally return memory to the operating system so just because the
process memory usage went up does *not* mean that the memory is still
in use. It might just mean that the memory is being held by the
malloc()/free() for possible reuse later. What does the
sqlite3_memory_used() interface tell you? What about
sqlite3_memory_highwater()?
Why does the first query require 2.5MB of memory? I don't know. That
would depend on your schema and the content of the database. Perhaps
it is going to cache. Perhaps something else. If one of the rows in
your table contains a 2.5MB blob, that would explain where the memory
is going, would it not? We will need quite a bit more information
from you if we are to help you debug your problem.
D. Richard Hipp
[EMAIL PROTECTED]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users